Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
+15 -1
View File
@@ -1,4 +1,4 @@
$Id: History 76884 2013-11-18 12:54:03Z gcosmo $
$Id: History 86749 2014-11-17 15:03:05Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -18,6 +18,20 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
envs-V10-00-03 / 15 Nov. 2014 K. Murakami
- complete migration to cmake for building library. (GNUmakefiles removed)
- update for 10.1 release, following changes of class interface.
- linker problem of OSX was fixed. (OSX Yosemite tested)
envs-V10-00-02 / May 25 2014 Koichi Murakami
- pyG4EllipticalCone.cc, add missing return in CreateEllipticalCone() method.
envs-V10-00-01 / May 25 2014 Koichi Murakami
- configure script, physics list is changed to be always turned on.
envs-V10-00-00 / May 25 2014 Koichi Murakami
- fix compile error on pyG4Polycone
envs-V09-06-00 / 15 November 2013 Koichi Murakami
[g4py]
- add support for CMake build (experimental)
+8 -9
View File
@@ -25,10 +25,14 @@ include(SetInstallPath)
find_package(Geant4 REQUIRED)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(Boost 1.36.0)
find_package(Boost)
find_package(XercesC)
find_package(ROOT)
if(NOT GEANT4_FOUND)
message(FATAL_ERROR "NOT Found Geant4.")
endif()
#------------------------------------------------------------------------------
# parameters for building
message(STATUS "--------------------------------------------------------")
@@ -45,12 +49,6 @@ endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
# compiler flags
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS
"-Wwrite-strings -Wno-variadic-macros -Wno-long-long -ansi -pipe -ftemplate-depth-255 -finline-functions -fpermissive -DBOOST_PYTHON_DYNAMIC_LIB")
endif()
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "--------------------------------------------------------")
@@ -63,7 +61,8 @@ add_subdirectory(source)
add_subdirectory(site-modules)
# examples
#add_subdirectory(examples EXCLUDE_FROM_ALL)
add_subdirectory(examples)
# tests
#add_subdirectory(tests EXCLUDE_FROM_ALL)
add_subdirectory(tests EXCLUDE_FROM_ALL)
-22
View File
@@ -1,22 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py
# ===========================================================
include ./config/config.gmk
SUBDIR := source site-modules
.PHONY: all install clean uninstall
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
uninstall:
@-\rm -f -r $(Q_LIBDIR)
+13
View File
@@ -11,6 +11,19 @@ Geant4Py is a Geant4-Python bridge.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
15 Nov. 2014 K. Murakami
- complete migration to cmake for building library. (GNUmakefiles removed)
- update for 10.1 release, following changes of class interface.
- linker problem of OSX was fixed. (OSX Yosemite tested)
May 25 2014 Koichi Murakami
- remove IsGeneric() method in pyG4Polyone.cc because that method is removed.
(bug-id 1544)
- configure script, physics list is changed to be always turned on.
(bug-id 1546)
- pyG4EllipticalCone.cc, add missing return in CreateEllipticalCone() method.
(bug-id 1586)
15 November 2013 K.Murakami
- add support for CMake build
- updated for 10.0 release
+40 -78
View File
@@ -191,112 +191,74 @@ body .highlight pre, pre{background-color:#f8f8f8;border:1px solid #ccc;font-siz
body pre code, pre tt{background-color:transparent;border:none;}
</style></head>
<body>
<h1>Geant4Py</h1>
<h1 id="toc_0">Geant4Py</h1>
<p><em>A set of python modules for using Geant4</em></p>
<h2>System Requirements</h2>
<h2 id="toc_1">System Requirements</h2>
<h3>Python</h3>
<h3 id="toc_2">CMake</h3>
<p>Building system is migrated to CMake system.</p>
<h3 id="toc_3">Python</h3>
<p>Python2.x and Python 3.x (experimental)</p>
<h3>Geant4</h3>
<h3 id="toc_4">Boost</h3>
<p>built with CMake</p>
<p>Boost_Python is needed.</p>
<h3>CLHEP</h3>
<p>use Geant4-CLHEP</p>
<h3>(Optional)</h3>
<h3 id="toc_5">(Optional)</h3>
<p>ROOT for histogramming/analysis</p>
<h2>How to Install</h2>
<h3 id="toc_6">Tested Platforms</h3>
<p>There is a configuration script for building the package.</p>
<ul>
<li>CentOS6 (RH6 clones)</li>
<li>OSX Yosemite</li>
</ul>
<pre><code># ./configure --help
`configure&#39; configures Geant4Py to adapt to many kinds of systems.
<h2 id="toc_7">How to Install</h2>
Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]...
<p>Before building library, <em>GEANT4_INSTALL</em> environment variable should be set.</p>
SYSTEM: System type (see Supported Arhitectures)
Options:
-h, --help Display this help and exit
Installation directories:
--prefix=PREFIX Installation prefix [./]
--libdir=DIR Python modules dir [PREFIX/lib]
Fine tuning of the library path:
--with-g4install-dir=DIR Geant4 installed dir
--with-python-incdir=DIR Python header dir [/usr/include/python(2.#)],
(location of pyconfig.h)
--with-python-libdir=DIR Python library dir [/usr/lib(64)]
--with-python3 Use Python3
--with-boost-incdir=DIR BOOST-C++ header dir [/usr/include],
(location of boost/)
--with-boost-libdir=DIR BOOST-C++ library dir [/usr/lib]
--with-boost-python-lib=LIB library name of libboost_python.so [boost_python]
--with-extra-dir=DIR Install path for extra packages [/usr/local]
--with-xercesc-incdir=DIR Xerces-C header dir [/usr/include]
--with-xercesc-libdir=DIR Xerces-C library dir [/usr/lib(64)]
Enable/disable options: prefix with either --enable- or --disable-
openglx OpenGLX support [auto]
openglxm OpenGLXm support [disable]
raytracerx RayTracerX support [disable]
Supported Architectures:
linux for Linux gcc (32bit)
linux64 for Linux gcc (64bit)
linuxx8664gcc for Linux gcc (64bit)
macosx for Apple OS X with gcc
<pre><code># export GEANT4_INSTALL=&lt;Geant4 install path&gt; (zsh, bash)
# setenv GEANT4_INSTALL &lt;Geant4 install path&gt; (csh)
(G4 install path is the path specified by &quot;CMAKE_INSTALL_PREFIX&quot; when building Geant4)
</code></pre>
<p>For example,</p>
<p>then</p>
<pre><code># ./configure linux64 -with-g4install-dir=&lt;geant4 install path with CMake&gt;
</code></pre>
<p>The configuration script will create config/config.gmk,
which describes your environment.</p>
<p>After executing the <code>configure</code> script, then </p>
<pre><code># make
<pre><code># mkdir build
# cd build
# cmake ..
# make
# make install
</code></pre>
<h2>How to Use:</h2>
<p>If you want to run the testing component,</p>
<pre><code># cd build/tests
# make; make install
</code></pre>
<p>By default, g4py is installed in &lt;g4py&gt;/lib(64) directory.</p>
<h2 id="toc_8">How to Use:</h2>
<p>Some environment variables are required at run time.</p>
<h3><em>PYTHONPATH</em></h3>
<h3 id="toc_9"><em>PYTHONPATH</em></h3>
<p>Python module search directories, given by a colon-separated list of directories.
Practically, <code>$(INSTALL_PATH)/lib</code> is ok.</p>
<p>Python module search directories, given by a colon-separated list of directories, like</p>
<h3><em>LD_LIBRARY_PATH</em></h3>
<pre><code># export PYTHONPATH=&lt;g4py&gt;/lib64:&lt;g4py&gt;/examples:&lt;g4py&gt;/tests (zsh, bash)
# setenv PYTHONPATH &lt;g4py&gt;/lib64:&lt;g4py&gt;/examples:&lt;g4py&gt;/tests (csh)
</code></pre>
<p>Additional shared library path to be searched.</p>
<p>Some libraries paths are already specified via <em>-rpath</em> linker option,
so these paths do not have to be added to <em>LD_LIBRARY_PATH</em>.</p>
<ul>
<li>Geant4</li>
<li>boost-python library</li>
<li>$(INSTALL_PATH)/lib</li>
<li>$(G4PY_EXLIB_LIBDIR) specified in a module makefile.</li>
</ul>
<h3 id="toc_10">Getting started</h3>
<p>You can import Geant4Py modules in Python just like</p>
+33 -72
View File
@@ -6,83 +6,51 @@ _A set of python modules for using Geant4_
System Requirements
-------------------
### CMake
Building system is migrated to CMake system.
### Python
Python2.x and Python 3.x (experimental)
### Geant4
### Boost
built with CMake
### CLHEP
use Geant4-CLHEP
Boost_Python is needed.
### (Optional)
ROOT for histogramming/analysis
### Tested Platforms
* CentOS6 (RH6 clones)
* OSX Yosemite
How to Install
--------------
There is a configuration script for building the package.
Before building library, *GEANT4_INSTALL* environment variable should be set.
# ./configure --help
`configure' configures Geant4Py to adapt to many kinds of systems.
Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]...
SYSTEM: System type (see Supported Arhitectures)
Options:
-h, --help Display this help and exit
Installation directories:
--prefix=PREFIX Installation prefix [./]
--libdir=DIR Python modules dir [PREFIX/lib]
Fine tuning of the library path:
--with-g4install-dir=DIR Geant4 installed dir
# export GEANT4_INSTALL=<Geant4 install path> (zsh, bash)
# setenv GEANT4_INSTALL <Geant4 install path> (csh)
(G4 install path is the path specified by "CMAKE_INSTALL_PREFIX" when building Geant4)
--with-python-incdir=DIR Python header dir [/usr/include/python(2.#)],
(location of pyconfig.h)
--with-python-libdir=DIR Python library dir [/usr/lib(64)]
--with-python3 Use Python3
--with-boost-incdir=DIR BOOST-C++ header dir [/usr/include],
(location of boost/)
--with-boost-libdir=DIR BOOST-C++ library dir [/usr/lib]
--with-boost-python-lib=LIB library name of libboost_python.so [boost_python]
--with-extra-dir=DIR Install path for extra packages [/usr/local]
--with-xercesc-incdir=DIR Xerces-C header dir [/usr/include]
--with-xercesc-libdir=DIR Xerces-C library dir [/usr/lib(64)]
Enable/disable options: prefix with either --enable- or --disable-
openglx OpenGLX support [auto]
openglxm OpenGLXm support [disable]
raytracerx RayTracerX support [disable]
Supported Architectures:
linux for Linux gcc (32bit)
linux64 for Linux gcc (64bit)
linuxx8664gcc for Linux gcc (64bit)
macosx for Apple OS X with gcc
For example,
# ./configure linux64 -with-g4install-dir=<geant4 install path with CMake>
The configuration script will create config/config.gmk,
which describes your environment.
After executing the `configure` script, then
then
# mkdir build
# cd build
# cmake ..
# make
# make install
If you want to run the testing component,
# cd build/tests
# make; make install
By default, g4py is installed in \<g4py\>/lib(64) directory.
How to Use:
-----------
@@ -90,22 +58,15 @@ Some environment variables are required at run time.
### *PYTHONPATH*
Python module search directories, given by a colon-separated list of directories.
Practically, `$(INSTALL_PATH)/lib` is ok.
### *LD\_LIBRARY\_PATH*
Additional shared library path to be searched.
Some libraries paths are already specified via *-rpath* linker option,
so these paths do not have to be added to *LD\_LIBRARY\_PATH*.
* Geant4
* boost-python library
* $(INSTALL_PATH)/lib
* $(G4PY\_EXLIB\_LIBDIR) specified in a module makefile.
Python module search directories, given by a colon-separated list of directories, like
# export PYTHONPATH=<g4py>/lib64:<g4py>/examples:<g4py>/tests (zsh, bash)
# setenv PYTHONPATH <g4py>/lib64:<g4py>/examples:<g4py>/tests (csh)
### Getting started
You can import Geant4Py modules in Python just like
>>> import Geant4
-35
View File
@@ -1,35 +0,0 @@
# $Id: build.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Script for building a module
# ===========================================================
headers := $(wildcard *.hh)
sources := $(wildcard *.cc)
objects := $(patsubst %.cc, %.o, $(sources))
.PHONY: clean debug
# building module...
ifdef MODULE
module_name := $(MODULE).$(modext)
$(module_name) : $(objects)
$(build-module)
endif
# building shared library...
ifdef LIBRARY
module_name := $(LIBRARY).$(soext)
$(module_name) : $(objects)
$(build-library)
endif
module : $(module_name)
clean :
@-rm -f $(module_name)
@-rm -f $(objects)
debug:
@echo debug...
-39
View File
@@ -1,39 +0,0 @@
# $Id: g4compile.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Script for building a Boost-Python module
# ===========================================================
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
# include/lib directives started...
INCFLAGS := -I.
LOPT :=
# Geant4
G4PY_INCFLAGS := -I$(Q_G4_INCDIR)
# CLHEP
G4PY_INCFLAGS += -I$(Q_CLHEP_INCDIR)
G4PY_LOPT += -L$(Q_CLHEP_LIBDIR) -l$(Q_CLHEP_LIB)
# finished
CXXFLAGS += $(INCFLAGS)
CXXFLAGS += $(G4PY_INCFLAGS)
LOPT += $(G4PY_LOPT)
# ===========================================================
# Script for building a module
# ===========================================================
headers := $(wildcard *.hh)
sources := $(wildcard *.cc)
objects := $(patsubst %.cc, %.o, $(sources))
.PHONY: clean debug
compile : $(objects)
clean :
@-rm -f $(objects)
debug:
@echo debug...
-43
View File
@@ -1,43 +0,0 @@
# $Id: g4py.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Makefile for building Python module with Boost.Python
#
# ===========================================================
COMPILE_G4PY := true
G4PY_INCFLAGS := -I$(Q_G4_INCDIR)
G4PY_LOPT := -L$(Q_G4_LIBDIR) \
-lG4persistency \
-lG4readout \
-lG4physicslists \
-lG4run \
-lG4event \
-lG4tracking \
-lG4parmodels \
-lG4processes \
-lG4digits_hits \
-lG4track \
-lG4particles \
-lG4geometry \
-lG4materials \
-lG4graphics_reps \
-lG4intercoms \
-lG4interfaces \
-lG4global \
-lG4clhep
include $(G4PY_INSTALL)/config/g4vis.gmk
G4PY_LOPT += $(G4PY_VISLIBS)
G4PY_LOPT += -lm -lz -lexpat
# geant4 version
G4PY_INCFLAGS += -I$(G4PY_INSTALL)/source/version
# boost patch
G4PY_INCFLAGS += -I$(G4PY_INSTALL)/source/boost
# gdml
ifeq ($(Q_ENABLE_GDML), 1)
CPPFLAGS += -DENABLE_GDML
endif
-55
View File
@@ -1,55 +0,0 @@
# $Id: g4vis.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Makefile for building Python module with Boost.Python
#
# ===========================================================
G4PY_VISLIBS :=
# Not needing external packages or libraries...
G4PY_VISLIBS += -lG4FR
G4PY_VISLIBS += -lG4visHepRep
G4PY_VISLIBS += -lG4RayTracer
G4PY_VISLIBS += -lG4VRML
G4PY_VISLIBS += -lG4Tree
ifeq ($(Q_ENABLE_OPENGLX), 1)
Q_ENABLE_OPENGL = 1
CPPFLAGS += -DG4VIS_USE_OPENGLX
endif
ifeq ($(Q_ENABLE_OPENGLXM), 1)
Q_ENABLE_OPENGL = 1
CPPFLAGS += -DG4VIS_USE_OPENGLXM
endif
ifeq ($(Q_ENABLE__OPENGLWIN32), 1)
Q_ENABLE_OPENGL = 1
CPPFLAGS += -DG4VIS_USE_OPENGLWIN32
endif
ifeq ($(Q_ENABLE_OPENGL), 1)
CPPFLAGS += -DG4VIS_USE_OPENGL
G4PY_VISLIBS += -lG4OpenGL
endif
ifeq ($(Q_ENABLE_RAYTRACERX), 1)
CPPFLAGS += -DG4VIS_USE_RAYTRACERX
endif
ifeq ($(Q_ENABLE_DAWN), 1)
CPPFLAGS += -DG4VIS_USE_DAWN
endif
ifeq ($(Q_ENABLE_VRML), 1)
CPPFLAGS += -DG4VIS_USE_VRML
endif
ifeq ($(Q_ENABLE_GL2PS), 1)
G4PY_VISLIBS += -lG4gl2ps
endif
CPPFLAGS += -DG4VIS_USE
G4PY_VISLIBS += -lG4vis_management
G4PY_VISLIBS += -lG4modeling
-11
View File
@@ -1,11 +0,0 @@
# $Id: install.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Script for installing modules
# ===========================================================
G4PY_LIBDIR := $(Q_LIBDIR)/Geant4
install: $(module_name)
@echo ... intall $(module_name) into $(G4PY_LIBDIR)
@if [ ! -d $(G4PY_LIBDIR) ]; then install -d $(G4PY_LIBDIR); fi
@install -m 755 $(module_name) $(G4PY_LIBDIR)
-64
View File
@@ -1,64 +0,0 @@
# $Id: module.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Script for building a Boost-Python module
# ===========================================================
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
# include/lib directives started...
INCFLAGS := -I.
LOPT :=
ifdef G4PY_EXLIB_LIBNAME
ifdef G4PY_EXLIB_INCDIR
INCFLAGS += -I$(G4PY_EXLIB_INCDIR)
endif
ifdef G4PY_EXLIB_LIBNAME
LOPT += -L$(G4PY_EXLIB_LIBDIR) -l$(G4PY_EXLIB_LIBNAME)
endif
endif
# Python...
INCFLAGS += -I$(Q_PYTHON_INCDIR)
# Boost.Python...
ifneq ($(Q_BOOST_INCDIR), /usr/include)
INCFLAGS += -I$(Q_BOOST_INCDIR)
endif
ifneq ($(Q_BOOST_LIBDIR), /usr/lib)
ifneq ($(Q_BOOST_LIBDIR), /usr/lib64)
LOPT += -L$(Q_BOOST_LIBDIR)
endif
endif
LOPT += -l$(Q_BOOST_PYTHON_LIB)
# Xerces-C ...
ifdef Q_XERCESC_INCDIR
ifneq ($(Q_XERCESC_INCDIR), /usr/include)
INCFLAGS += -I$(Q_XERCESC_INCDIR)
endif
endif
ifdef Q_XERCESC_LIBDIR
ifneq ($(Q_XERCESC_LIBDIR), /usr/lib)
ifneq ($(Q_XERCESC_LIBDIR), /usr/lib64)
LOPT += -L$(Q_XERCESC_LIBDIR)
endif
endif
LOPT += -lxerces-c
endif
# finished
CXXFLAGS += $(INCFLAGS)
ifdef COMPILE_G4PY
CXXFLAGS += $(G4PY_INCFLAGS)
LOPT += $(G4PY_LOPT)
endif
# ok, building...
include $(G4PY_INSTALL)/config/build.gmk
-16
View File
@@ -1,16 +0,0 @@
# $Id: mylib.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Script for building my libray
# ===========================================================
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
# include/lib directives started...
INCFLAGS := -I.
LOPT :=
# finished
CXXFLAGS += $(INCFLAGS)
# ok, building...
include $(G4PY_INSTALL)/config/build.gmk
@@ -1,21 +0,0 @@
# $Id: script-install.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Script for installing modules
# ===========================================================
pys := $(wildcard *.py)
pycs := $(patsubst %.py, %.pyc, $(pys))
pyos := $(patsubst %.py, %.pyo, $(pys))
.PHONY: clean
all: $(pycs) $(pyos)
install: $(pycs) $(pyos)
@echo ... intall "*.py" into $(install_dir)
@if [ ! -d $(install_dir) ]; then install -d $(install_dir); fi
@install -m 644 $(pys) $(pycs) $(pyos) $(install_dir)
clean:
@-\rm -f $(pycs) $(pyos)
-16
View File
@@ -1,16 +0,0 @@
# $Id: site-install.gmk 66892 2013-01-17 10:57:59Z gunter $
# ===========================================================
# Script for installing modules
# ===========================================================
ifndef PACKAGE
PACKAGE := .
endif
install_dir := $(Q_LIBDIR)/g4py/$(PACKAGE)
install: $(module_name)
@echo ... intall $(module_name) into $(install_dir)
@if [ ! -d $(install_dir) ]; then install -d $(install_dir); fi
@install -m 755 $(module_name) $(install_dir)
-91
View File
@@ -1,91 +0,0 @@
# $Id: linux.gmk 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# System specific terms
# ===========================================================
# compile flags
CXX := g++ -m32
ifdef COMPILE_WITH_BOOST
CXXFLAGS := -fPIC -ftemplate-depth-255 -finline-functions -Wno-inline
CXXFLAGS += -fpermissive
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
else
CXXFLAGS := -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
CXXFLAFS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
CXXFLAGS += -fPIC
CXXFLAGS += -O2
endif
ifdef COMPILE_G4PY
CXXFLAGS := -fPIC -ansi -pipe
CXXFLAGS += -ftemplate-depth-255 -finline-functions
CXXFLAGS += -fpermissive
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
endif
# extention of shared library
soext := so
modext := so
# implicit rules
%.o: %.cc
ifdef CPPVERBOSE
$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
else
@echo Compiling $< ...
@$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
endif
%.pyc: %.py; $(Q_PYTHON) -c 'import py_compile; py_compile.compile( "$<" )'
%.pyo: %.py; $(Q_PYTHON) -O -c 'import py_compile; py_compile.compile( "$<" )'
# building a shared library
ifdef Q_BOOST_LIBDIR
rpath0 := $(Q_BOOST_LIBDIR)
endif
ifdef COMPILE_G4PY
rpath1 := $(Q_G4_LIBDIR)
ifneq ($(Q_CLHEP_LIBDIR), $(Q_G4_LIBDIR))
rpath2 := $(Q_CLHEP_LIBDIR)
endif
endif
ifdef G4PY_EXLIB_LIBDIR
rpath3 := $(G4PY_EXLIB_LIBDIR)
endif
rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3)
ifdef CPPVERBOSE
define build-library
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects)
endef
else
define build-library
@echo Building a library $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects)
endef
endif
ifdef CPPVERBOSE
define build-module
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT)
endef
else
define build-module
@echo Building a module $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT)
endef
endif
@@ -1,91 +0,0 @@
# $Id: linuxx8664gcc.gmk 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# System specific terms
# ===========================================================
# compile flags
CXX := g++ -m64
ifdef COMPILE_WITH_BOOST
CXXFLAGS := -fPIC -ftemplate-depth-255 -finline-functions -Wno-inline
CXXFLAGS += -fpermissive
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
else
CXXFLAGS := -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
CXXFLAFS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
CXXFLAGS += -fPIC
CXXFLAGS += -O2
endif
ifdef COMPILE_G4PY
CXXFLAGS := -fPIC -ansi -pipe
CXXFLAGS += -ftemplate-depth-255 -finline-functions
CXXFLAGS += -fpermissive
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
endif
# extention of shared library
soext := so
modext := so
# implicit rules
%.o: %.cc
ifdef CPPVERBOSE
$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
else
@echo Compiling $< ...
@$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
endif
%.pyc: %.py; $(Q_PYTHON) -c 'import py_compile; py_compile.compile( "$<" )'
%.pyo: %.py; $(Q_PYTHON) -O -c 'import py_compile; py_compile.compile( "$<" )'
# building a shared library
ifdef Q_BOOST_LIBDIR
rpath0 := $(Q_BOOST_LIBDIR)
endif
ifdef COMPILE_G4PY
rpath1 := $(Q_G4_LIBDIR)
ifneq ($(Q_CLHEP_LIBDIR), $(Q_G4_LIBDIR))
rpath2 := $(Q_CLHEP_LIBDIR)
endif
endif
ifdef G4PY_EXLIB_LIBDIR
rpath3 := $(G4PY_EXLIB_LIBDIR)
endif
rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3)
ifdef CPPVERBOSE
define build-library
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects)
endef
else
define build-library
@echo Building a library $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects)
endef
endif
ifdef CPPVERBOSE
define build-module
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT)
endef
else
define build-module
@echo Building a module $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT)
endef
endif
-88
View File
@@ -1,88 +0,0 @@
# $Id: macosx.gmk 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# System specific terms
#
# MacOSX 10.4 (Tiger/Leopard) gcc 4.0.1
# Note: gc-3.3 is not valid for this setup.
# ===========================================================
# compile flags
CXX := g++
ifdef COMPILE_WITH_BOOST
CXXFLAGS := -ftemplate-depth-256
CXXFLAGS += -no-cpp-precomp -finline-functions -Wno-inline
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
else
CXXFLAGS := -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
CXXFLAGS += -O2
endif
ifdef COMPILE_G4PY
CXXFLAGS := -ansi -pipe
CXXFLAGS += -ftemplate-depth-256
CXXFLAGS += -no-cpp-precomp -finline-functions -Wno-inline
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
endif
# extention of shared library
soext := dylib
modext := so
# implicit rules
%.o: %.cc
ifdef CPPVERBOSE
$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
else
@echo Compiling $< ...
@$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
endif
%.pyc: %.py; $(Q_PYTHON) -c 'import py_compile; py_compile.compile( "$<" )'
%.pyo: %.py; $(Q_PYTHON) -O -c 'import py_compile; py_compile.compile( "$<" )'
# building a shared library
ifdef LOCALLIB
install_path := $(PWD)
else
install_path := $(Q_LIBDIR)
endif
ifdef CPPVERBOSE
define build-library
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
-o $@ -install_name $(install_path)/$@ $(objects)
endef
else
define build-library
@echo Building a module $@ ...
@$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
-o $@ -install_name $(install_path)/$@ $(objects)
endef
endif
# building a module
ifdef CPPVERBOSE
define build-module
$(CXX) -Wl,-x -bundle -flat_namespace -dead_strip -undefined suppress \
-o $@ $(objects) $(LOPT)
endef
else
define build-module
@echo Building a module $@ ...
@$(CXX) -Wl,-x -bundle -flat_namespace -dead_strip -undefined suppress \
-o $@ $(objects) $(LOPT)
endef
endif
-540
View File
@@ -1,540 +0,0 @@
#! /bin/sh -
# ======================================================================
# A configure script for Geant4Py
# ======================================================================
export LANG=C
PATH=/bin:/usr/bin
export PATH
# ======================================================================
# testing the echo features
# ======================================================================
if `(echo "testing\c"; echo 1,2,3) | grep c > /dev/null` ; then
if `(echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn > /dev/null`; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi
# ======================================================================
# help message
# ======================================================================
show_help() {
cat <<EOF
\`configure' configures Geant4Py to adapt to many kinds of systems.
Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]...
SYSTEM: System type (see Supported Arhitectures)
Options:
-h, --help Display this help and exit
Installation directories:
--prefix=PREFIX Installation prefix [./]
--libdir=DIR Python modules dir [PREFIX/lib]
Fine tuning of the library path:
--with-g4install-dir=DIR Geant4 installed dir
--with-python-incdir=DIR Python header dir [/usr/include/python(2.#)],
(location of pyconfig.h)
--with-python-libdir=DIR Python library dir [/usr/lib(64)]
--with-python3 Use Python3
--with-boost-incdir=DIR BOOST-C++ header dir [/usr/include],
(location of boost/)
--with-boost-libdir=DIR BOOST-C++ library dir [/usr/lib]
--with-boost-python-lib=LIB library name of libboost_python.so [boost_python]
--with-extra-dir=DIR Install path for extra packages [/usr/local]
--with-xercesc-incdir=DIR Xerces-C header dir [/usr/include]
--with-xercesc-libdir=DIR Xerces-C library dir [/usr/lib(64)]
Enable/disable options: prefix with either --enable- or --disable-
openglx OpenGLX support [auto]
openglxm OpenGLXm support [disable]
raytracerx RayTracerX support [disable]
Supported Architectures:
linux for Linux gcc (32bit)
linux64 for Linux gcc (64bit)
linuxx8664gcc for Linux gcc (64bit)
macosx for Apple OS X with gcc
EOF
}
# ======================================================================
# main
# ======================================================================
# input
arguments="$@"
# default values
prefix=`pwd`
current_dir=`pwd`
g4_incdir=/zzz
g4_libdir=/zzz
python_incdir=/zzz
python_exe=python
with_python3=0
boost_incdir=/usr/include
boost_python_lib=boost_python
enable_openglx=1
enable_openglxm=0
enable_raytracerx=0
enable_gl2ps=0
enable_physicslist=0
enable_gdml=0
xercesc_incdir=/usr/include
extra_dir=/usr/local
# checking system
case $1 in
linux|linux64|linuxx8664gcc|macosx)
system=$1
if [ $system = linux64 ]; then
system=linuxx8664gcc
fi
echo $ac_n "Checking for system type ... $ac_c"
if [ ! -e "config/sys/$system.gmk" ]; then
echo "no"
echo $ac_n "### Invalid system type. $ac_c"
echo "Please taka a look in config/sys/."
exit -1
fi
echo "$system"
;;
--help|-h)
show_help
exit 0
;;
*)
echo "Error: System type is not specified or more than one system type. "
echo ""
echo "Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]..."
echo ""
exit -1
;;
esac
shift
# parsing options
while test $# -gt 0
do
case $1 in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--help|-h) show_help; exit 0 ;;
# ---------------------------------------------------------------
--prefix=*) prefix=$optarg ;;
--libdir=*) libdir=$optarg ;;
--with-g4install-dir=*) g4_install=$optarg ;;
--with-extra-dir=*) extra_dir=$optarg ;;
--with-python-incdir=*) python_incdir=$optarg ;;
--with-python-libdir=*) python_libdir=$optarg ;;
--with-python3 ) python_exe=python3
with_python3=1
boost_python_lib=boost_python3 ;;
--with-boost-incdir=*) boost_incdir=$optarg ;;
--with-boost-libdir=*) boost_libdir=$optarg ;;
--with-boost-python-lib=*) boost_python_lib=$optarg ;;
--with-xercesc-incdir=*) xercesc_incdir=$optarg ;;
--with-xercesc-libdir=*) xercesc_libdir=$optarg ;;
# ---------------------------------------------------------------
--enable-openglx ) enable_openglx=1 ;;
--disable-openglx ) enable_openglx=0 ;;
--enable-openglxm ) enable_openglxm=1 ;;
--disable-openglxm ) enable_openglxm=0 ;;
--enable-raytracerx ) enable_raytracerx=1 ;;
--disable-raytracerx ) enable_raytracerx=0 ;;
# ---------------------------------------------------------------
-*)
echo "Unrecognized option: $1"
exit -1
;;
*)
echo "Invalid argument: $1"
exit -1
;;
esac
shift
done
# check variables
arch=32
if [ $system = linuxx8664gcc ]; then
arch=64
fi
shlib=so
if [ $system = macosx ]; then
shlib=dylib
fi
extra_incdir=$extra_dir/include
if [ $arch = 64 ];then
extra_libdir=$extra_dir/lib64
else
extra_libdir=$extra_dir/lib
fi
echo $ac_n "Checking for prefix ... $ac_c"
echo $prefix
echo $ac_n "Checking for lib dir ... $ac_c"
libdir=${libdir:-$prefix/lib}
echo $libdir
echo $ac_n "Checking for G4 include dir ... $ac_c"
g4_incdir=$g4_install/include/Geant4
if [ ! -d "$g4_incdir" ]; then
echo "no"
echo $ac_n "### Geant4 include directory does not exist. $ac_c"
exit -1
fi
echo "$g4_incdir"
# ---
echo $ac_n "Checking for G4 lib dir ... $ac_c"
if [ $arch = 64 ]; then
g4_libdir=$g4_install/lib64
else
g4_libdir=$g4_install/lib
fi
if [ ! -d "$g4_libdir" ]; then
echo "no"
echo $ac_n "### Geant4 lib directory does not exist. $ac_c"
exit -1
fi
echo "$g4_libdir"
echo $ac_n "Checking for G4 libs are shared libraray ... $ac_c"
if [ ! -f ${g4_libdir}/libG4run.${shlib} ]; then
echo "no"
echo $ac_n "### G4 libray must be global and shared. $ac_c"
echo "Recompile with global and shared mode."
exit -1
fi
echo "ok"
# ---
echo $ac_n "Checking for Python include dir (pyconfig.h) ... $ac_c"
if [ $python_incdir = /zzz ]; then
# check version
if [ $with_python3 = 0 ]; then
set python python2.7 python2.6 python2.5 python2.4 python2.3 python2.2
else
set python3.3 python3.2 python3.1 python3.0
fi
for aincdir in $*
do
if [ -d /usr/include/"$aincdir" ]; then
python_incdir=/usr/include/$aincdir
break
fi
done
fi
if [ ! -f "$python_incdir"/pyconfig.h ]; then
echo "no"
echo $ac_n "### $python_incdir (python-incdir) is invalid. $ac_c"
echo "Try --with-python-incdir option."
exit -1
fi
echo "$python_incdir"
echo $ac_n "Checking for Python lib dir ... $ac_c"
if [ ! $python_libdir ]; then
if [ $arch = 64 ]; then
python_libdir=/usr/lib64
else
python_libdir=/usr/lib
fi
fi
if [ ! -d "$python_libdir" ]; then
echo "no"
echo $ac_n "### $python_libdir (python-libdir) does not exist. $ac_c"
echo "Try --with-python-libdir option."
exit -1
fi
echo "$python_libdir"
# ---
echo $ac_n "Checking for Boost include dir (boost/python.hpp) ... $ac_c"
set $boost_incdir $extra_incdir
for adir in $*
do
if [ -f "$adir"/boost/python.hpp ]; then
boost_incdir=$adir
break
fi
done
if [ ! -f "$boost_incdir"/boost/python.hpp ]; then
echo "no"
echo $ac_n "### $boost_incdir (boost-incdir) is invalid. $ac_c"
echo "Try --with-boost-incdir option."
exit -1
fi
echo "$boost_incdir"
echo $ac_n "Checking for Boost version ... $ac_c"
cat > conftest.cc <<EOF
#include <boost/version.hpp>
int main() {
if (BOOST_VERSION >= 103200)
return 0;
else
return 1;
}
EOF
g++ -I$boost_incdir -o conftest conftest.cc > /dev/null 2>&1
./conftest
q_boost_version=$?
rm conftest.cc conftest
if [ $q_boost_version = 0 ]; then
echo "ok"
else
echo "boost version >= 1.32.00 is required."
exit -1
fi
echo $ac_n "Checking for Boost lib dir ... $ac_c"
if [ ! $boost_libdir ]; then
if [ $arch = 64 ]; then
boost_libdir=/usr/lib64
else
boost_libdir=/usr/lib
fi
fi
set $boost_libdir $extra_libdir
for adir in $*
do
if [ -f "$adir"/lib${boost_python_lib}.${shlib} ]; then
boost_libdir=$adir
break
fi
done
if [ ! -d "$boost_libdir" ]; then
echo "no"
echo $ac_n "### $boost_libdir (boost-libdir) does not exist. $ac_c"
echo "Try --with-boost-libdir option."
exit -1
fi
echo "$boost_libdir"
echo $ac_n "Checking for Boost Python lib name ... $ac_c"
if [ ! -f "$boost_libdir"/lib${boost_python_lib}.${shlib} ]; then
echo "no"
echo $ac_n "### lib${boost_python_lib}.${shlib} (boost-python-lib) does not exist. $ac_c"
echo "Try --with-boost-python-lib option."
exit -1
fi
echo "lib${boost_python_lib}.${shlib}"
# ---
echo $ac_n "Checking for OpenGL support ...$ac_c"
if [ -f "$g4_libdir"/libG4OpenGL.${shlib} ]; then
if [ $enable_openglx = 0 ]; then
echo "disabled"
else
echo "yes"
fi
else
echo "no"
enable_openglx=0
fi
# ---
echo $ac_n "Checking for GL2PS support ...$ac_c"
if [ -f "$g4_libdir"/libG4gl2ps.${shlib} ]; then
echo "yes"
enable_gl2ps=1
else
echo "no"
fi
# ---
echo $ac_n "Checking for physics list support ...$ac_c"
if [ -f "$g4_incdir"/QGSP.hh ]; then
enable_physicslist=1
fi
if [ $enable_physicslist = 0 ]; then
echo "no"
else
echo "yes"
fi
# ---
echo $ac_n "Checking for GDML support ...$ac_c"
if [ -f "$g4_incdir"/G4GDMLParser.hh ]; then
echo "yes"
enable_gdml=1
else
echo "no"
enable_gdml=0
fi
# ---
if [ $enable_gdml = 1 ]; then
echo $ac_n "Checking for Xerces-C include dir ...$ac_c"
set $xercesc_incdir $extra_incdir
for adir in $*
do
if [ -d "$adir/xercesc" ]; then
xercesc_incdir=$adir
break
fi
done
if [ -d "$xercesc_incdir/xercesc" ]; then
echo "yes"
else
echo "no"
echo "### $xercesc_incdir/xercesc does not exist. "
echo "Try --with-xercesc-incdir option."
exit -1
fi
echo $ac_n "Checking for Xerces-C lib dir ...$ac_c"
if [ ! $xercesc_libdir ]; then
if [ $arch = 64 ]; then
xercesc_libdir=/usr/lib64
else
xercesc_libdir=/usr/lib
fi
fi
set $xerces_libdir $extra_libdir
for adir in $*
do
if [ -f "$adir"/libxerces-c.${shlib} ]; then
xercesc_libdir=$adir
break
fi
done
if [ -f "$xercesc_libdir"/libxerces-c.${shlib} ]; then
echo "yes"
else
echo "no"
echo "### $xercesc_libdir/libxerces-c.${shlib} does not exist. "
echo "Try --with-xercesc-libdir option."
exit -1
fi
fi
# ---
echo $ac_n "Writing config.gmk ... $ac_c"
make_config=config/config.gmk
cat > $make_config <<EOF
# config.gmk
#
# Automatically generated by configure script
#
# Makefile definitions included by the top Makefile
G4PY_INSTALL := $current_dir
Q_SYSTEM := $system
Q_PREFIX := $prefix
Q_LIBDIR := $libdir
Q_G4_INCDIR := $g4_incdir
Q_G4_LIBDIR := $g4_libdir
EOF
cat >> $make_config <<EOF
Q_PYTHON_INCDIR := $python_incdir
Q_PYTHON_LIBDIR := $python_libdir
Q_PYTHON := $python_exe
Q_WITH_PYTHON3 := $with_python3
Q_BOOST_INCDIR := $boost_incdir
Q_BOOST_LIBDIR := $boost_libdir
Q_BOOST_PYTHON_LIB := $boost_python_lib
Q_ENABLE_OPENGLX := $enable_openglx
Q_ENABLE_OPENGLXM := $enable_openglxm
Q_ENABLE_RAYTRACERX := $enable_raytracerx
Q_ENABLE_GL2PS := $enable_gl2ps
Q_ENABLE_PHYSICSLIST := $enable_physicslist
Q_ENABLE_GDML := $enable_gdml
EOF
if [ $enable_gdml = 1 ]; then
cat >> $make_config <<EOF
Q_XERCESC_INCDIR := $xercesc_incdir
Q_XERCESC_LIBDIR := $xercesc_libdir
EOF
fi
echo "done"
echo $ac_n "Writing config.status ... $ac_c"
echo $arguments > config.status
echo "done"
# ---
echo ""
echo $ac_n "Enabled support for$ac_c"
if [ $enable_openglx = 1 ]; then
echo $ac_n " openglx$ac_c"
fi
if [ $enable_openglxm = 1 ]; then
echo $ac_n " openglxm$ac_c"
fi
if [ $enable_raytracerx = 1 ]; then
echo $ac_n " raytracerx$ac_c"
fi
if [ $enable_gl2ps = 1 ]; then
echo $ac_n " gl2ps$ac_c"
fi
if [ $enable_physicslist = 1 ]; then
echo $ac_n " physicslist$ac_c"
fi
if [ $enable_gdml = 1 ]; then
echo $ac_n " gdml$ac_c"
fi
echo "."
# ---
echo ""
echo "To build Geant4Py type:"
echo ""
echo " make"
echo " make install"
echo ""
exit 0
@@ -0,0 +1,7 @@
# - add examples
set(TEST_MODULES_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/examples)
# demos
add_subdirectory(demos/TestEm0/module)
add_subdirectory(demos/water_phantom/module)
@@ -1,10 +1,10 @@
#!/usr/bin/python
# ==================================================================
# python script for TestEm0 python version
# python script for testem0 python version
#
# ==================================================================
import Geant4 as g4
import TestEm0
import testem0
# ==================================================================
# user actions in python
@@ -15,17 +15,17 @@ import TestEm0
# main
# ==================================================================
myDC= TestEm0.DetectorConstruction()
myDC= testem0.DetectorConstruction()
g4.gRunManager.SetUserInitialization(myDC)
myPL= TestEm0.PhysicsList()
myPL= testem0.PhysicsList()
g4.gRunManager.SetUserInitialization(myPL)
# set user actions...
myPGA= TestEm0.PrimaryGeneratorAction(myDC)
myPGA= testem0.PrimaryGeneratorAction(myDC)
g4.gRunManager.SetUserAction(myPGA)
myRA= TestEm0.RunAction(myDC,myPGA)
myRA= testem0.RunAction(myDC,myPGA)
# set user action classes
g4.gRunManager.SetUserAction(myRA)
@@ -36,9 +36,9 @@ g4.gRunManager.Initialize()
pg = g4.G4ParticleGun()
materialList = TestEm0.getMaterialTable();
materialList = testem0.getMaterialTable();
particleList = TestEm0.getParticleTable()
particleList = testem0.getParticleTable()
enrgyList = ["eV","keV","MeV","GeV","TeV","PeV"]
@@ -56,7 +56,7 @@ class App(Frame):
def init(self):
# title and header
title = Label(self, text="TestEm0 empowered by Geant4Py\n\n\n")
title = Label(self, text="testem0 empowered by Geant4Py\n\n\n")
title.grid(row=0, column=1, columnspan = 4)
# particle list box
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../../config/config.gmk
# python module name
MODULE := ../TestEm0
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
@@ -0,0 +1,34 @@
# - build test library
include_directories(
${PYTHON_INCLUDE_PATH}
${Boost_INCLUDE_DIRS}
${GEANT4_INCLUDE_DIR}
)
link_directories (${GEANT4_LIBRARY_DIR} ${Boost_LIBRARY_DIRS})
# library
set(_TARGET testem0)
add_library(
${_TARGET} SHARED
DetectorConstruction.cc
DetectorMessenger.cc
PhysListEmStandard.cc
PhysicsList.cc
PhysicsListMessenger.cc
PrimaryGeneratorAction.cc
RunAction.cc
pytestem0.cc
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES OUTPUT_NAME "testem0")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${TEST_MODULES_INSTALL_DIR})
@@ -25,7 +25,7 @@
//
//
// $Id: DetectorConstruction.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: DetectorConstruction.cc 86749 2014-11-17 15:03:05Z gcosmo $
//
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: DetectorConstruction.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: DetectorConstruction.hh 86749 2014-11-17 15:03:05Z gcosmo $
//
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: DetectorMessenger.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: DetectorMessenger.cc 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: DetectorMessenger.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: DetectorMessenger.hh 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,10 +24,9 @@
// ********************************************************************
//
//
// $Id: PhysListEmStandard.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: PhysListEmStandard.cc 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysListEmStandard.hh"
#include "G4ParticleDefinition.hh"
@@ -52,6 +51,10 @@
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
#ifdef theParticleIterator
#undef theParticleIterator
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEmStandard::PhysListEmStandard(const G4String& name)
@@ -67,6 +70,9 @@ PhysListEmStandard::~PhysListEmStandard()
void PhysListEmStandard::ConstructProcess()
{
G4ParticleTable::G4PTblDicIterator*
theParticleIterator = theParticleTable-> GetIterator();
// Add standard EM Processes
theParticleIterator->reset();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: PhysListEmStandard.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: PhysListEmStandard.hh 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: PhysicsList.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: PhysicsList.cc 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: PhysicsList.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: PhysicsList.hh 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PhysicsListMessenger.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: PhysicsListMessenger.cc 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PhysicsListMessenger.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: PhysicsListMessenger.hh 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: PrimaryGeneratorAction.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: PrimaryGeneratorAction.cc 86749 2014-11-17 15:03:05Z gcosmo $
//
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PrimaryGeneratorAction.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: PrimaryGeneratorAction.hh 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: RunAction.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: RunAction.cc 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: RunAction.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: RunAction.hh 86749 2014-11-17 15:03:05Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyTestEm0.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: pyTestEm0.cc 66241 2012-12-13 18:34:42Z gunter $
// ====================================================================
// pyTestEm0.cc
//
@@ -85,7 +85,7 @@ boost::python::list getMaterialTable()
// Expose to Python
// ====================================================================
BOOST_PYTHON_MODULE(TestEm0) {
BOOST_PYTHON_MODULE(testem0) {
def ("getMaterialTable", getMaterialTable);
@@ -112,4 +112,3 @@ BOOST_PYTHON_MODULE(TestEm0) {
("PhysicsList", "testEm0 physics list")
;
}
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../../config/config.gmk
# python module name
MODULE := ../demo_wp#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
@@ -0,0 +1,29 @@
# - build test library
include_directories(
${PYTHON_INCLUDE_PATH}
${Boost_INCLUDE_DIRS}
${GEANT4_INCLUDE_DIR}
)
link_directories (${GEANT4_LIBRARY_DIR} ${Boost_LIBRARY_DIRS})
# library
set(_TARGET demo_wp)
add_library(
${_TARGET} SHARED
MyDetectorConstruction.cc
MyMaterials.cc
pydemo_wp.cc
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES OUTPUT_NAME "demo_wp")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${TEST_MODULES_INSTALL_DIR})
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MyDetectorConstruction.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: MyDetectorConstruction.cc 86749 2014-11-17 15:03:05Z gcosmo $
// ====================================================================
// MyDetectorConstruction.cc
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MyDetectorConstruction.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: MyDetectorConstruction.hh 86749 2014-11-17 15:03:05Z gcosmo $
// ====================================================================
// MyDetectorConstruction.hh
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MyMaterials.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: MyMaterials.cc 86749 2014-11-17 15:03:05Z gcosmo $
// ====================================================================
// MyMaterials.cc
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MyMaterials.hh 66892 2013-01-17 10:57:59Z gunter $
// $Id: MyMaterials.hh 86749 2014-11-17 15:03:05Z gcosmo $
// ====================================================================
// MyMaterials.hh
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pydemo_wp.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: pydemo_wp.cc 86749 2014-11-17 15:03:05Z gcosmo $
// ====================================================================
// pydemo_wp.cc
//
@@ -1,7 +1,6 @@
# vis.mac
/vis/open OGLIX
#/vis/open OGLSX
/vis/open OGLSX
/vis/scene/create
/vis/scene/add/volume
@@ -1,557 +0,0 @@
#!/usr/bin/python
from Geant4 import *
import g4py.NISTmaterials
import g4py.ezgeom
from g4py.ezgeom import G4EzVolume
import g4py.ExN03pl
import g4py.ParticleGun
from time import *
import sys
from subprocess import *
import os
# ==================================================================
# intialize
# ==================================================================
def Configure():
# ------------------------------------------------------------------
# setup for materials
# ------------------------------------------------------------------
# simple materials for Qgeom
g4py.NISTmaterials.Construct()
# ------------------------------------------------------------------
# setup for geometry
# ------------------------------------------------------------------
g4py.ezgeom.Construct() # initialize
# ------------------------------------------------------------------
# setup for physics list of N03
# ------------------------------------------------------------------
g4py.ExN03pl.Construct()
# ------------------------------------------------------------------
# setup for primary generator action
# ------------------------------------------------------------------
g4py.ParticleGun.Construct()
gControlExecute("gun.mac")
# ==================================================================
# constructing geometry
# ==================================================================
def ConstructGeom():
print "* Constructing geometry..."
# reset world material
global absorber
air= G4Material.GetMaterial("G4_AIR", 1)
galactic = G4Material.GetMaterial("G4_Galactic", 1)
absorber = {} # material's dictionary to be used by a radiobutton
aluminum = G4Material.GetMaterial("G4_Al", 1)
iron = G4Material.GetMaterial("G4_Fe", 1)
silver = G4Material.GetMaterial("G4_Ag", 1)
gold = G4Material.GetMaterial("G4_Au", 1)
lead = G4Material.GetMaterial("G4_Pb", 1)
water = G4Material.GetMaterial("G4_WATER", 1)
absorber = {"air":air, "aluminum":aluminum, "iron":iron, "lead":lead, "water":water, "gold":gold
}
g4py.ezgeom.SetWorldMaterial(galactic)
g4py.ezgeom.ResizeWorld(120.*cm, 120.*cm, 100.*cm)
# water phantom
global water_phantom, water_phantom_pv
water_phantom= G4EzVolume("WaterPhantom")
water_phantom.CreateBoxVolume(water, 110.*cm, 110.*cm, 10.*cm)
water_phantom_pv = water_phantom.PlaceIt(G4ThreeVector(0.,0.,0.*cm))
# ==================================================================
# main
# ==================================================================
# ------------------------------------------------------------------
# randum number
# ------------------------------------------------------------------
#print "Random numbers..."
rand_engine= Ranlux64Engine()
HepRandom.setTheEngine(rand_engine)
HepRandom.setTheSeed(20050830L)
# setup...
Configure()
ConstructGeom()
# ------------------------------------------------------------------
# go...
# ------------------------------------------------------------------
gRunManager.Initialize()
global commandDic, commandList
commandDic = {}
commandList = []
def DumpTree(atree):
ntree= atree.GetTreeEntry()
ncommand= atree.GetCommandEntry()
for i in range(1, ncommand+1):
icommand= atree.GetCommand(i)
command = str( icommand.GetCommandPath())
commandList.append(command)
nparameter= icommand.GetParameterEntries()
pguide = ""
for j in range(0, nparameter):
iparam= icommand.GetParameter(j)
pguide = pguide + "Parameter: " + str(iparam.GetParameterName())+ " Type: " + str(iparam.GetParameterType()) + '\n'
guide = str(icommand.GetTitle()) + '\n' + pguide
commandDic[command] = guide
for i in range(1, ntree+1):
itree= atree.GetTree(i)
DumpTree(itree)
root_tree= gUImanager.GetTree()
DumpTree(root_tree)
# visualization
# OGLSX, VRML and HEPREP sceneHandlers are all created with names
gApplyUICommand("/vis/sceneHandler/create OGLSX OGLSX")
gApplyUICommand("/vis/sceneHandler/create VRML2FILE VRML")
gApplyUICommand("/vis/sceneHandler/create HepRepFile HEPREP")
# OGLSX is the default so, viewer is created and volume is drawn
gApplyUICommand("/vis/viewer/create OGLSX oglsxviewer")
gApplyUICommand("/vis/viewer/select oglsxviewer")
gApplyUICommand("/vis/drawVolume")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
gApplyUICommand("/vis/viewer/set/viewpointThetaPhi 90. 0.")
gApplyUICommand("/vis/viewer/set/style s")
# viewers VRML and Wired are tested by their envs vars
# if their envs var are set, then viewers are created and drawVolume
global heprepViewer, heprepDir, heprepName, vrmlViewer
heprepViewer = os.environ.get("G4HEPREPFILE_VIEWER")
heprepDir = os.environ.get("G4HEPREPFILE_DIR")
heprepName = os.environ.get("G4HEPREPFILE_NAME")
if heprepViewer is not None:
gApplyUICommand("/vis/viewer/create HEPREP wired")
# gApplyUICommand("/vis/drawVolume")
# VRML viewers name is user defined
vrmlDir = os.environ.get("G4VRML_DEST_DIR")
vrmlViewer = os.environ.get("G4VRMLFILE_VIEWER")
if vrmlViewer is not None:
gApplyUICommand("/vis/viewer/create VRML vrmlviewer")
# gApplyUICommand("/vis/drawVolume")
###############################
###### wxPython GUI ##########
###############################
import wx
class ComPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.g4comText = wx.TextCtrl(parent, -1, "enter Command", pos=(10,10), size=(300, 30))
self.g4comExec = wx.Button(parent, -1, "Execute", pos=(320,10), size=(60,30))
self.g4comExec.Bind(wx.EVT_BUTTON, self.ExecuteCommand, self.g4comExec)
self.comListBox = wx.ListBox(parent, -1, pos=(10,50), size=(300,200), choices=commandList, style=wx.LB_SINGLE)
self.comListBox.SetSelection(1)
self.comListBox.Bind(wx.EVT_LISTBOX, self.ShowGuide, self.comListBox)
self.guide = wx.TextCtrl(parent, -1, "guidance", pos=(320,50), size=(300, 200), style =wx.TE_MULTILINE)
self.guide.Bind(wx.EVT_LISTBOX, self.ShowGuide, self.guide)
def ShowGuide(self, event):
self.guide.Clear() # how to cleat the whole text before showing the next
g4com =str(self.comListBox.GetStringSelection())
self.guide.WriteText( commandDic[g4com])
self.g4comText.SetValue(g4com)
def ExecuteCommand(self, event):
gApplyUICommand(str(self.g4comText.GetValue()))
class VisPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.visZoomIn = wx.Button(parent, -1, "Zoom In", pos=(10,100), size=(80,30))
self.visZoomOut = wx.Button(parent, -1, "Zoom out", pos=(100,100), size=(80,30))
self.visUp = wx.Button(parent, -1, "Up", pos=(190,100), size=(80,30))
self.visDown = wx.Button(parent, -1, "Down", pos=(270,100), size=(80,30))
self.visLeft = wx.Button(parent, -1, "Left", pos=(360,100), size=(80,30))
self.visRight = wx.Button(parent, -1, "Left", pos=(450,100), size=(80,30))
viewerList = ["OpenGL", "VRML", "Wired"]
self.viewer = wx.RadioBox(self, -1, "Viewer", pos=(10,10),
size=(210,60), choices=viewerList, majorDimension=1, style=wx.RA_SPECIFY_ROWS)
self.viewer.Bind(wx.EVT_RADIOBOX, self.ViewerSelected, self.viewer)
self.viewer.SetToolTip(wx.ToolTip("Select one"))
self.viewer.SetSelection(0)
if vrmlViewer == None: self.viewer.EnableItem(1, False)
if heprepViewer == None: self.viewer.EnableItem(2, False)
self.visZoomIn.Bind(wx.EVT_BUTTON, self.cmdExpand, self.visZoomIn)
self.visZoomOut.Bind(wx.EVT_BUTTON, self.cmdShrink, self.visZoomOut)
self.visUp.Bind(wx.EVT_BUTTON, self.cmdUp, self.visUp)
self.visDown.Bind(wx.EVT_BUTTON, self.cmdDown, self.visDown)
self.visRight.Bind(wx.EVT_BUTTON, self.cmdRight, self.visRight)
self.visLeft.Bind(wx.EVT_BUTTON, self.cmdLeft, self.visLeft)
def cmdExpand(self, event):
gApplyUICommand("/vis/viewer/zoom 1.2")
def cmdShrink(self, event):
gApplyUICommand("/vis/viewer/zoom 0.8")
def cmdUp(self, event):
gApplyUICommand("/vis/viewer/pan " + " 0. 10. mm")
def cmdDown(self, event):
gApplyUICommand("/vis/viewer/pan " + " 0. -10. mm")
def cmdRight(self, event):
gApplyUICommand("/vis/viewer/pan " + " -1. 0. mm")
def cmdLeft(self, event):
gApplyUICommand("/vis/viewer/pan " + " 1. 0. mm")
def ViewerSelected(self, event):
self.viewerName = event.GetString()
if self.viewerName == "OpenGL":
gApplyUICommand("/vis/viewer/select oglsxviewer")
gApplyUICommand("/vis/drawVolume")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
if self.viewerName == "VRML":
gApplyUICommand("/vis/viewer/select vrmlviewer")
gApplyUICommand("/vis/viewer/set/viewpointThetaPhi 90. 0.")
gApplyUICommand("/vis/viewer/set/style s")
gApplyUICommand("/vis/drawVolume")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
if self.viewerName == "Wired":
gApplyUICommand("/vis/viewer/select wired")
gApplyUICommand("/vis/viewer/set/viewpointThetaPhi 90. 0.")
gApplyUICommand("/vis/viewer/set/style s")
gApplyUICommand("/vis/drawVolume")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
# everytime wired is chosen, a new instance of wired is created
# to reuse single wired, g4pipe.poll() must be checked BEFORE the SECOND Popen
# if g4pipe.poll() == None:
g4pipe=Popen(heprepViewer+ " -file " + heprepDir+"/" +heprepName +".heprep", shell=True)
# not used
class MyText(wx.StaticText):
def __init__(self, parent, Text):
wx.StaticText.__init__(self, parent, -1, Text, pos=(20,20))
self.Bind(wx.EVT_LEFT_UP, self.ChangeColor)
def ChangeColor(self, event):
TheColour = self.GetForegroundColour()
if TheColour == (0,0,0):
self.SetLabel("Simulation is running!")
self.SetForegroundColour("red")
else:
self.SetLabel("Click me to start a run")
self.SetForegroundColour("black")
# to be used to choose materials and particles
# myList is a list of keys() of a dictionary
# f.e., materials are Python objects with their names as their keys
class SelectOne(wx.RadioBox):
def __init__(self, parent, myTitle, myList):
wx.RadioBox.__init__(self, parent, -1, myTitle, wx.DefaultPosition,
wx.DefaultSize, myList, 3, wx.RA_SPECIFY_ROWS)
# self.Bind(wx.EVT_RADIOBOX, self.Selected)
self.SetToolTip(wx.ToolTip("Select one"))
self.SetSelection(0)
# used only to test Bind and getValue
# def Selected(self, event):
# self.selected = event.GetString()
# used to %3.3f floating point number
# energy and length unit is given by unitList which must be a dictionary
# with units of Python objects and their name as their keys
class FloatCounter(wx.Panel):
def __init__(self, parent, myTitle, unitList):
wx.Panel.__init__(self, parent, -1)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.sizer.Add((10, -1))
self.sizer.Add(wx.StaticText(parent, -1, myTitle, wx.DefaultPosition, (100, -1)))
self.intPart = wx.SpinCtrl(parent, -1, "", wx.DefaultPosition, (60,-1))
self.intPart.SetRange(0,999)
self.intPart.SetValue(1)
self.intPart.Bind(wx.EVT_SPINCTRL, self.SetFloat)
self.manPart = wx.SpinCtrl(parent, -1, "", wx.DefaultPosition, (50, -1))
self.manPart.SetRange(0,999)
self.manPart.SetValue(0)
self.manPart.Bind(wx.EVT_SPINCTRL, self.SetFloat)
self.unitSel = wx.Choice(parent, -1, wx.DefaultPosition, (90, -1), unitList)
self.unitSel.Bind(wx.EVT_CHOICE, self.SetFloat, self.unitSel)
self.unitSel.SetSelection(2)
self.valAndUnit = wx.TextCtrl(parent, -1, "value unset", wx.DefaultPosition, (150, -1))
self.sizer.Add(self.valAndUnit)
self.sizer.Add((10, -1))
self.sizer.Add(wx.StaticText(parent, -1, " ", wx.DefaultPosition, (30, -1)))
self.sizer.Add(self.intPart)
self.sizer.Add(wx.StaticText(parent, -1, ".", wx.DefaultPosition, (10, -1)))
self.sizer.Add(self.manPart)
self.sizer.Add((5,-1))
self.sizer.Add(self.unitSel)
self.SetSizer(self.sizer)
def SetFloat(self, event):
# self.theValue = str(self.intPart.GetValue()) + "." + str(self.manPart.GetValue()) + " "
self.theValue = float (self.intPart.GetValue()) + float(self.manPart.GetValue())/ 1000.
self.theUnit = self.unitSel.GetStringSelection()
theText = "%.3f" % (self.theValue) + " " + self.theUnit
self.valAndUnit.SetValue(theText)
# user may edit the Entry, so finnaly this value must be got
# but it doesn't work for length but work for energy (gApplyUIcommnd)
# special class for this example to set/unset processes
class Processes(wx.Panel):
def __init__(self, parent, myTitle, myList):
wx.Panel.__init__(self, parent, -1)
self.processCheck = {}
self.sizer = wx.FlexGridSizer(rows=3)
self.sizer.AddGrowableRow(1)
for item in myList:
self.processCheck[item] = wx.CheckBox(parent, -1, item)
self.processCheck[item].SetValue(True)
# self.processCheck[item].Bind(wx.EVT_CHECKBOX, self.CheckedProcess)
self.sizer.Add(self.processCheck[item],0,wx.EXPAND)
self.SetSizer(self.sizer)
self.SetBackgroundColour('green')
self.processState = {}
self.myList = myList
# test only
# def CheckedProcess(self, event):
# self.processName = event.GetEventObject().GetLabel()
# self.processState = event.GetEventObject().GetValue()
# slider to set an integer value
# title is shown
class Adjuster(wx.Panel):
def __init__(self, parent, myTitle, minVal, maxVal, initVal):
wx.Panel.__init__(self, parent, -1)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.sizer.Add((10, -1))
self.sizer.Add(wx.StaticText(parent, -1, myTitle, wx.DefaultPosition, (100, -1)))
self.slider = wx.Slider(parent, -1, initVal, minVal, maxVal,
wx.DefaultPosition, (300, -1),
wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
self.slider.SetPageSize(1)
self.sizer.Add(self.slider)
self.SetSizer(self.sizer)
# test only
# self.Bind(wx.EVT_SLIDER, self.Adjusted)
# def Adjusted(self, event):
# print self.GetValue()
########################## no use now
class Counter(wx.SpinCtrl):
def __init__(self, parent, myTitle, minVal, maxVal, initVal):
wx.SpinCtrl.__init__(self, parent, -1, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_RIGHT)
self.SetRange(minVal, maxVal)
self.SetValue(initVal)
self.Bind(wx.EVT_SPINCTRL, self.Adjusted)
def Adjusted(self, event):
print self.GetValue()
############################
############################
# WxPython Application class
############################
# main class to instantiate the above classes and pack them using nested sizers
class MyApp(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Geant4Py", wx.DefaultPosition, size=(650,500))
self.nb = wx.Notebook(self, -1, wx.DefaultPosition, size=(650,500),
style=
wx.NB_TOP # | wx.NB_MULTILINE
#wx.NB_BOTTOM
#wx.NB_LEFT
#wx.NB_RIGHT
)
self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging)
panel = wx.Panel(self.nb)
self.nb.AddPage(panel, "Lesson1")
commandPanel = wx.Panel(self.nb)
self.nb.AddPage(commandPanel, "Geant4 Commands")
comP = ComPanel(commandPanel)
gxsizer = wx.BoxSizer(wx.HORIZONTAL)
gxsizer.Add(comP)
commandPanel.SetSizer(gxsizer)
visualizationPanel = wx.Panel(self.nb)
self.nb.AddPage(visualizationPanel, "Vis Commands")
visP = VisPanel(visualizationPanel)
vxsizer = wx.BoxSizer(wx.HORIZONTAL)
vxsizer.Add(visP)
visualizationPanel.SetSizer(vxsizer)
# outmost sizer in the vertical direction
bxsizer = wx.BoxSizer(wx.VERTICAL)
# nested sizer in the horizontal direction
bysizer = wx.BoxSizer(wx.HORIZONTAL)
self.runStart = wx.Button(panel, -1, " Run Start", pos=(30,10), size=(80,30))
self.Bind(wx.EVT_BUTTON, self.RunStart, self.runStart)
bxsizer.Add(self.runStart, 0, wx.ALL)
# widgets
materialList = absorber.keys()
self.theMaterial = SelectOne(panel, "Materials", materialList)
particleList = ['gamma', 'e-', 'proton']
self.theParticle = SelectOne(panel, "Particles", particleList)
self.processList = ["phot", "compt", "conv", "msc", "eIoni", "eBrem", "annihil", "hIoni"]
self.theProcesses = Processes(panel, "Processes", self.processList)
self.eventNo = Adjuster(panel, "Number of Events", 1 , 100 , 1)
self.lengthUnit = {'micrometer':micrometer, 'mm':mm, 'cm':cm, 'm':m}
self.thickSpin = FloatCounter(panel, "absorber thickness", self.lengthUnit.keys())
self.energyUnit = { 'keV':keV, 'MeV':MeV, 'GeV':GeV, 'TeV':TeV, 'PeV':PeV}
self.energySpin = FloatCounter(panel, "incident beam energy", self.energyUnit.keys())
# now sizers
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bysizer.Add((10, -1))
bysizer.Add(self.theMaterial, 0, wx.EXPAND, 10)
bysizer.Add((10, -1))
bysizer.Add(self.theParticle, 0, wx.EXPAND, 10)
bysizer.Add((10, -1))
bysizer.Add(self.theProcesses.sizer, 0, wx.EXPAND, 10)
bxsizer.Add(bysizer, 0, wx.EXPAND)
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bxsizer.Add(self.energySpin.sizer, 0, wx.EXPAND)
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bxsizer.Add(self.thickSpin.sizer, 0, wx.EXPAND)
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bxsizer.Add(self.eventNo.sizer, 0, wx.EXPAND)
self.solid = g4py.ezgeom.G4EzVolume.GetSold(water_phantom)
panel.SetSizer(bxsizer)
bxsizer.Fit(self)
bxsizer.SetSizeHints(self)
def OnPageChanged(self, event):
old = event.GetOldSelection()
new = event.GetSelection()
sel = self.nb.GetSelection()
event.Skip()
def OnPageChanging(self, event):
old = event.GetOldSelection()
new = event.GetSelection()
sel = self.nb.GetSelection()
event.Skip()
###### Run Action
def RunStart(self, event):
materialChosen = str( self.theMaterial.GetStringSelection() )
water_phantom.SetMaterial(absorber[materialChosen])
if materialChosen == "water":
water_phantom.SetColor(0., 0.9, 1.0)
if materialChosen == "air":
water_phantom.SetColor(0.9, 0.9, 1.0)
if materialChosen == "lead":
water_phantom.SetColor(0.2, 0.2, 0.2)
if materialChosen == "iron":
water_phantom.SetColor(0.7, 0.5, 0.7)
if materialChosen == "aluminum":
water_phantom.SetColor(.7, 0.9, 1.0)
if materialChosen == "gold":
water_phantom.SetColor(1., 0.9, .0)
self.solid.SetZHalfLength( self.thickSpin.theValue * self.lengthUnit[self.thickSpin.theUnit] / 2.0 )
#
gApplyUICommand("/vis/scene/add/text 0 610 610 mm 20 0 0 " + "Geant4Py in Action")
gApplyUICommand("/vis/viewer/flush")
gApplyUICommand("/gun/particle " + str ( self.theParticle.GetStringSelection() ) )
for i in self.processList:
# print i, self.theProcesses.processCheck[i].GetValue()
gProcessTable.SetProcessActivation(i, 1)
if self.theProcesses.processCheck[i].GetValue() != True:
gProcessTable.SetProcessActivation(i, 0)
gApplyUICommand("/gun/energy " + str ( self.energySpin.valAndUnit.GetValue() ) )
eventNum = self.eventNo.slider.GetValue()
for i in range(eventNum):
gunYZpos = str(i-eventNum/2) + ". -50. cm"
gApplyUICommand("/gun/position 0. " + gunYZpos)
gRunManager.BeamOn(1)
# next line is necessary for vrml to draw trajectories
gApplyUICommand("/vis/viewer/update")
app = wx.PySimpleApp(False)
MyApp().Show()
app.MainLoop()
@@ -1,319 +0,0 @@
#!/usr/bin/python
# ==================================================================
# python script for "measurement" of mass attenuation coefficient
#
#
# - using site-module packages
# ==================================================================
from Geant4 import *
import g4py.NISTmaterials
import g4py.ezgeom
from g4py.ezgeom import G4EzVolume
import g4py.ExN03pl
import g4py.ParticleGun
from time import *
import sys
# ==================================================================
# intialize
# ==================================================================
def Configure():
# ------------------------------------------------------------------
# setup for materials
# ------------------------------------------------------------------
# simple materials for Qgeom
g4py.NISTmaterials.Construct()
# ------------------------------------------------------------------
# setup for geometry
# ------------------------------------------------------------------
#g4py.Qgeom.Construct()
g4py.ezgeom.Construct() # initialize
# ------------------------------------------------------------------
# setup for physics list
# ------------------------------------------------------------------
g4py.ExN03pl.Construct()
# ------------------------------------------------------------------
# setup for primary generator action
# ------------------------------------------------------------------
g4py.ParticleGun.Construct()
gControlExecute("gun.mac")
# ==================================================================
# constructing geometry
# ==================================================================
def ConstructGeom():
print "* Constructing geometry..."
# reset world material
global absorber
air= G4Material.GetMaterial("G4_AIR", 1)
galactic = G4Material.GetMaterial("G4_Galactic", 1)
absorber = {} # material's dictionary to be used by a radiobutton
aluminum = G4Material.GetMaterial("G4_Al", 1)
iron = G4Material.GetMaterial("G4_Fe", 1)
silver = G4Material.GetMaterial("G4_Ag", 1)
gold = G4Material.GetMaterial("G4_Au", 1)
lead = G4Material.GetMaterial("G4_Pb", 1)
water = G4Material.GetMaterial("G4_WATER", 1)
absorber = {"air":air, "aluminum":aluminum, "iron":iron, "lead":lead, "water":water, "gold":gold}
g4py.ezgeom.SetWorldMaterial(galactic)
g4py.ezgeom.ResizeWorld(120.*cm, 120.*cm, 100.*cm)
# water phantom
global water_phantom, water_phantom_pv
water_phantom= G4EzVolume("WaterPhantom")
water_phantom.CreateBoxVolume(water, 110.*cm, 110.*cm, 10.*cm)
water_phantom_pv = water_phantom.PlaceIt(G4ThreeVector(0.,0.,0.*cm))
# ==================================================================
# main
# ==================================================================
# ------------------------------------------------------------------
# randum number
# ------------------------------------------------------------------
print "Random numbers..."
rand_engine= Ranlux64Engine()
HepRandom.setTheEngine(rand_engine)
HepRandom.setTheSeed(20050830L)
# setup...
Configure()
ConstructGeom()
# ------------------------------------------------------------------
# go...
# ------------------------------------------------------------------
gRunManager.Initialize()
# visualization not here but after "Start a run" button
gControlExecute("oglx.mac")
#gControlExecute("vrml.mac")
# creating widgets using grid layout
from Tkinter import *
class App(Frame):
def init(self):
#title and header row=0, 1
title = Label(self, text="Geant4Py for Education @ H. Yoshida Naruto Univ. of Education")
title.grid(row=0, column=1, columnspan=5)
header = Label(self, text="Measurement of Mass Attenuation Coefficient")
header.grid(row=1, column=1, columnspan=5)
#material selection row=2
materialLabel = Label(self, bg="green", text="Material")
materialLabel.grid(row=2, column=0, sticky=W)
self.materialVar = StringVar()
self.materialVar.set("water")
ra1 = { }
pos=1
for i in absorber.keys():
ra1[i] = Radiobutton(self, text=i, variable=self.materialVar, value=i)
ra1[i].grid(row=2, column=pos, sticky=W)
pos=pos+1
#absorber thickness row=3
thickLabel = Label(self, bg="green", text="Thickness (mm)")
self.thickVar = DoubleVar()
self.thickVar.set(100.0)
thick = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=100., resolution=0.05, tickinterval=10.0, digits=4, variable=self.thickVar)
thickLabel.grid(row=3, column=0, sticky=W)
thick.grid(row=3, column=1, columnspan=5, sticky=W)
#get logical volume and set its half length
self.solid = g4py.ezgeom.G4EzVolume.GetSold(water_phantom)
#particle row=4
particleLabel = Label(self, bg="green", text="Particle")
particleLabel.grid(row=4, column=0, sticky=W)
self.particleVar = StringVar()
self.particleVar.set("gamma")
ra1 = { }
pos1=1
for i in ("gamma", "e-", "proton"):
ra1[i] = Radiobutton(self, text=i, variable=self.particleVar, value=i)
ra1[i].grid(row=4, column=pos1, sticky=W)
pos1=pos1+1
#energy row=5
energyLabel = Label(self, bg="green", text="Energy (MeV)")
self.energyVar=StringVar()
self.energyVar.set(1)
energy = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=100., tickinterval=10.0, resolution=0.1, variable=self.energyVar, digits=4 )
energyLabel.grid(row=5, column=0, sticky=W)
energy.grid(row=5, column=1, columnspan=5, sticky=W)
#number of event row=6
eventLabel = Label(self, bg="green", text="Events")
self.eventVar=IntVar()
event = Scale(self, orient=HORIZONTAL, length=400, from_=1, to=100, tickinterval=10, resolution=1, variable=self.eventVar )
eventLabel.grid(row=6, column=0, sticky=W)
event.grid(row=6, column=1, columnspan=5, sticky=W)
#start a run button row=7
startBut = Button(self, bg="orange", text="Start a run", command=self.cmd_beamOn)
startBut.grid(row=0, column=0, sticky=W)
#on off processes
processLabel = Label(self, text="Process On/Off", bg="green")
processLabel.grid(row=8, column=0, sticky=W)
procTab = {}
self.processList = ["phot", "compt", "msc", "conv", "eIoni", "eBrem", "hIoni"]
self.processVar = {}
pos = 1
for i in self.processList:
self.processVar[i] = IntVar()
procTab[i] = Checkbutton(self, text=i, variable=self.processVar[i], command=self.cmd_setProcess)
procTab[i].grid(row=8, column=pos, sticky=W)
pos = pos + 1
procTab[i].select()
#Zoom in/out Pan X Y row=9
visLabel = Label(self, text="viewer", bg="orange")
expandBut = Button(self, text="Zoom in", command=self.cmd_expand)
shrinkBut = Button(self, text="Zoom out", command=self.cmd_shrink)
visLabel.grid(row=9, column=0, sticky=W)
expandBut.grid(row=9, column=1, sticky=W)
shrinkBut.grid(row=9, column=2, sticky=W)
upBut = Button(self, text="Up", command=self.cmd_up)
downBut = Button(self, text="Down", command=self.cmd_down)
upBut.grid(row=9, column=3, sticky=W)
downBut.grid(row=9, column=4, sticky=W)
leftBut = Button(self, text="Left", command=self.cmd_left)
rightBut = Button(self, text="Right", command=self.cmd_right)
leftBut.grid(row=9, column=5, sticky=W)
rightBut.grid(row=9, column=6, sticky=W)
# later
# resetBut = Button(self, text="Reset", command=self.cmd_reset)
# resetBut.grid(row=8, column=7, sticky=W)
# panLabel = Label(self, text="Pan X Y (mm)")
# self.panXYVar = StringVar()
# panXYEnt = Entry(self, textvariable=self.panXYVar)
# panBut = Button(self, bg="orange", text="OK", command=self.cmd_pan)
# panLabel.grid(row=8, column=3, sticky=W)
# panXYEnt.grid(row=8, column=4)
# panBut.grid(row=8, column=5)
#Geant4 command entry row = 9
# g4comLabel = Label(self, text="Geant4 command")
# self.g4commandVar = StringVar()
# commandEntry = Entry(self, textvariable=self.g4commandVar)
# comBut = Button(self, bg="orange", text="Execute", command=self.cmd_g4command)
# g4comLabel.grid(row=9, column=0, sticky=W)
# commandEntry.grid(row=9, column=1, columnspan=4, sticky=E+W)
# comBut.grid(row=9, column=5)
#exit row = 10
exitBut = Button(self, bg="red", text="End all", command=sys.exit)
exitBut.grid(row=0, column=6, sticky=W)
#on Run butto do...
def cmd_beamOn(self):
materialChosen = self.materialVar.get()
water_phantom.SetMaterial(absorber[materialChosen])
if materialChosen == "water":
water_phantom.SetColor(0., 0.9, 1.0)
if materialChosen == "air":
water_phantom.SetColor(0.9, 0.9, 1.0)
if materialChosen == "lead":
water_phantom.SetColor(0.2, 0.2, 0.2)
if materialChosen == "iron":
water_phantom.SetColor(0.7, 0.5, 0.7)
if materialChosen == "aluminum":
water_phantom.SetColor(.7, 0.9, 1.0)
if materialChosen == "gold":
water_phantom.SetColor(1., 0.9, .0)
self.solid.SetZHalfLength(self.thickVar.get() * mm/2.0)
# gControlExecute("oglx.mac") #draw for each run
gApplyUICommand("/vis/viewer/flush")
self.cmd_particle(self.particleVar.get())
self.cmd_energy(self.energyVar.get())
# TODO later to reflesh text
gApplyUICommand("/vis/scene/add/text 0 610 610 mm 20 0 0 " + " ")
gApplyUICommand("/vis/scene/add/text 0 610 610 mm 20 0 0 " + self.materialVar.get() + " = " + str(self.thickVar.get()) + "mm " + self.particleVar.get() + " = "+self.energyVar.get() + "MeV")
eventNum = self.eventVar.get()
for i in range(eventNum):
gunYZpos = str(i-eventNum/2) + ". -20. cm"
gApplyUICommand("/gun/position 0. " + gunYZpos)
gRunManager.BeamOn(1)
sleep(0.01)
# self.cmd_expand() #Zoom in to the last diaplayed OGLSX
# self.cmd_shrink()
def cmd_g4command(self):
gApplyUICommand(self.g4commandVar.get())
def cmd_particle(self, particle):
gApplyUICommand("/gun/particle " + particle)
def cmd_setProcess(self):
for i in self.processList:
if self.processVar[i].get() == 0:
gProcessTable.SetProcessActivation(i, 0)
else:
gProcessTable.SetProcessActivation(i, 1)
def cmd_energy(self, penergy):
gApplyUICommand("/gun/energy " + penergy + " MeV")
def cmd_expand(self):
gApplyUICommand("/vis/viewer/zoom 1.2")
def cmd_up(self):
gApplyUICommand("/vis/viewer/pan " + " 0. 10. mm")
def cmd_down(self):
gApplyUICommand("/vis/viewer/pan " + " 0. -10. mm")
def cmd_right(self):
gApplyUICommand("/vis/viewer/pan " + " -1. 0. mm")
def cmd_left(self):
gApplyUICommand("/vis/viewer/pan " + " 1. 0. mm")
def cmd_shrink(self):
gApplyUICommand("/vis/viewer/zoom 0.8")
# def cmd_reset(self):
# gApplyUICommand("/vis/viewer/pan " + " 0. 0. mm")
def __init__(self, master=None):
Frame.__init__(self, master)
self.init()
self.grid()
app = App()
app.mainloop()
@@ -1,600 +0,0 @@
#!/usr/bin/python
#### 2006 Sep 26, the first draft version
## Wired not yet. g4pipe control and Popen
from Geant4 import *
import g4py.Qmaterials, g4py.NISTmaterials
import g4py.ExN03geom
import g4py.ExN03pl
import g4py.ParticleGun, g4py.MedicalBeam
import sys
from time import *
from subprocess import *
import os
# ==================================================================
# main
# ==================================================================
# ------------------------------------------------------------------
# randum number
# ------------------------------------------------------------------
rand_engine= Ranlux64Engine()
HepRandom.setTheEngine(rand_engine)
HepRandom.setTheSeed(20050830L)
# ------------------------------------------------------------------
# setup for materials
# ------------------------------------------------------------------
# NIST materials
#g4py.NISTmaterials.Construct()
# ------------------------------------------------------------------
# setup for geometry
# ------------------------------------------------------------------
# normal way for constructing user geometry
exN03geom= g4py.ExN03geom.ExN03DetectorConstruction()
gRunManager.SetUserInitialization(exN03geom)
# 2nd way, short-cut way
#g4py.ExN01geom.Construct()
#g4py.ExN03geom.Construct()
# magnetic field
#exN03geom.SetMagField(0.1 * tesla)
# ------------------------------------------------------------------
# setup for physics list
# ------------------------------------------------------------------
# normal way for constructing user physics list
exN03PL= g4py.ExN03pl.PhysicsList()
gRunManager.SetUserInitialization(exN03PL)
# 2nd way, short-cut way
#g4py.ExN01pl.Construct()
# ------------------------------------------------------------------
# setup for primary generator action
# ------------------------------------------------------------------
# normal way for constructing user physics list
#pgPGA= g4py.ParticleGun.ParticleGunAction()
#gRunManager.SetUserAction(pgPGA)
#pg= pgPGA.GetParticleGun()
# 2nd way, short-cut way
pg= g4py.ParticleGun.Construct()
# set parameters of particle gun
pg.SetParticleByName("e-")
pg.SetParticleEnergy(50.*MeV)
pg.SetParticlePosition(G4ThreeVector(-40.,0.,0.)*cm)
pg.SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.))
# medical beam
#beam= MedicalBeam.Construct()
# ------------------------------------------------------------------
# go...
# ------------------------------------------------------------------
gRunManager.Initialize()
# visualization
# OGLSX, VRML and HEPREP sceneHandlers are all created with names
gApplyUICommand("/vis/sceneHandler/create OGLSX OGLSX")
gApplyUICommand("/vis/sceneHandler/create VRML2FILE VRML")
gApplyUICommand("/vis/sceneHandler/create HepRepFile HEPREP")
# OGLSX is the default so, viewer is created and volume is drawn
gApplyUICommand("/vis/viewer/create OGLSX oglsxviewer")
gApplyUICommand("/vis/drawVolume")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
gApplyUICommand("/vis/viewer/select oglsxviewer")
# viewers VRML and Wired are tested by their envs vars
# if their envs var are set, then viewers are created and drawVolume
global heprepViewer, heprepDir, heprepName, vrmlViewer
heprepViewer = os.environ.get("G4HEPREPFILE_VIEWER")
heprepDir = os.environ.get("G4HEPREPFILE_DIR")
heprepName = os.environ.get("G4HEPREPFILE_NAME")
if heprepViewer is not None:
gApplyUICommand("/vis/viewer/create HEPREP wired")
gApplyUICommand("/vis/drawVolume")
# VRML viewers name is user defined
vrmlDir = os.environ.get("G4VRML_DEST_DIR")
vrmlViewer = os.environ.get("G4VRMLFILE_VIEWER")
if vrmlViewer is not None:
gApplyUICommand("/vis/viewer/create VRML vrmlviewer")
gApplyUICommand("/vis/drawVolume")
# test############################################################################TESSSSSSST
gApplyUICommand("/vis/viewer/select oglsxviewer")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
#test########################################################################################
global commandDic, commandList
commandDic = {}
commandList = []
def DumpTree(atree):
ntree= atree.GetTreeEntry()
ncommand= atree.GetCommandEntry()
for i in range(1, ncommand+1):
icommand= atree.GetCommand(i)
command = str( icommand.GetCommandPath())
commandList.append(command)
nparameter= icommand.GetParameterEntries()
pguide = ""
for j in range(0, nparameter):
iparam= icommand.GetParameter(j)
pguide = pguide + "Parameter: " + str(iparam.GetParameterName())+ " Type: " + str(iparam.GetParameterType()) + '\n'
guide = str(icommand.GetTitle()) + '\n' + pguide
commandDic[command] = guide
for i in range(1, ntree+1):
itree= atree.GetTree(i)
DumpTree(itree)
root_tree= gUImanager.GetTree()
DumpTree(root_tree)
###### wxPython GUI ##########
import wx
class ComPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.g4comText = wx.TextCtrl(parent, -1, "enter Command", pos=(10,10), size=(300, 30))
self.g4comExec = wx.Button(parent, -1, "Execute", pos=(320,10), size=(60,30))
self.g4comExec.Bind(wx.EVT_BUTTON, self.ExecuteCommand, self.g4comExec)
# self.sizerE = wx.BoxSizer(wx.HORIZONTAL)
# self.sizerE.Add(self.g4comText)
# self.sizerE.Add(self.g4comExec)
# self.sizerL = wx.BoxSizer(wx.HORIZONTAL)
self.comListBox = wx.ListBox(parent, -1, pos=(10,50), size=(300,200), choices=commandList, style=wx.LB_SINGLE)
self.comListBox.SetSelection(1)
self.comListBox.Bind(wx.EVT_LISTBOX, self.ShowGuide, self.comListBox)
# self.sizerL.Add(self.comListBox)
self.guide = wx.TextCtrl(parent, -1, "guidance", pos=(320,50), size=(300, 200), style =wx.TE_MULTILINE)
self.guide.Bind(wx.EVT_LISTBOX, self.ShowGuide, self.guide)
# self.sizerL.Add(self.guide)
# self.sizer = wx.BoxSizer(wx.VERTICAL)
# self.sizer.Add(self.sizerE)
# self.sizer.Add(self.sizerL)
# self.SetSizer(self.sizer)
def ShowGuide(self, event):
self.guide.Clear() # how to cleat the whole text before showing the next
g4com =str(self.comListBox.GetStringSelection())
self.guide.WriteText( commandDic[g4com])
self.g4comText.SetValue(g4com)
def ExecuteCommand(self, event):
gApplyUICommand(str(self.g4comText.GetValue()))
class VisPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.visZoomIn = wx.Button(parent, -1, "Zoom In", pos=(10,100), size=(80,30))
self.visZoomOut = wx.Button(parent, -1, "Zoom out", pos=(100,100), size=(80,30))
self.visUp = wx.Button(parent, -1, "Up", pos=(190,100), size=(80,30))
self.visDown = wx.Button(parent, -1, "Down", pos=(270,100), size=(80,30))
self.visLeft = wx.Button(parent, -1, "Left", pos=(360,100), size=(80,30))
self.visRight = wx.Button(parent, -1, "Left", pos=(450,100), size=(80,30))
viewerList = ["OpenGL", "VRML", "Wired"]
self.viewer = wx.RadioBox(self, -1, "Viewer", pos=(10,10),
size=(210,60), choices=viewerList, majorDimension=1, style=wx.RA_SPECIFY_ROWS)
self.viewer.Bind(wx.EVT_RADIOBOX, self.ViewerSelected, self.viewer)
self.viewer.SetToolTip(wx.ToolTip("Select one"))
self.viewer.SetSelection(0)
if vrmlViewer == None: self.viewer.EnableItem(1, False)
if heprepViewer == None: self.viewer.EnableItem(2, False)
# self.sizer = wx.BoxSizer(wx.HORIZONTAL)
# self.sizer.Add((20,30))
# self.sizer.Add(self.visZoomIn)
# self.sizer.Add(self.visZoomOut)
# self.sizer.Add(self.visUp)
# self.sizer.Add(self.visDown)
# self.sizer.Add(self.visRight)
# self.sizer.Add(self.visLeft)
# self.SetSizer(self.sizer)
# self.visZoomIn = wx.Button(parent, -1, "Zoom In", pos=(10,70), size=(80,30))
# self.visZoomOut = wx.Button(parent, -1, "Zoom out", pos=(100,70), size=(80,30))
# self.visUp = wx.Button(parent, -1, "Up", pos=(10,50), size=(190,70))
# self.visDown = wx.Button(parent, -1, "Down", pos=(100,50), size=(270,70))
# self.visLeft = wx.Button(parent, -1, "Left", pos=(10,90), size=(360,70))
# self.visRight = wx.Button(parent, -1, "Left", pos=(100,90), size=(450,70))
self.visZoomIn.Bind(wx.EVT_BUTTON, self.cmdExpand, self.visZoomIn)
self.visZoomOut.Bind(wx.EVT_BUTTON, self.cmdShrink, self.visZoomOut)
self.visUp.Bind(wx.EVT_BUTTON, self.cmdUp, self.visUp)
self.visDown.Bind(wx.EVT_BUTTON, self.cmdDown, self.visDown)
self.visRight.Bind(wx.EVT_BUTTON, self.cmdRight, self.visRight)
self.visLeft.Bind(wx.EVT_BUTTON, self.cmdLeft, self.visLeft)
def cmdExpand(self, event):
gApplyUICommand("/vis/viewer/zoom 1.2")
def cmdShrink(self, event):
gApplyUICommand("/vis/viewer/zoom 0.8")
def cmdUp(self, event):
gApplyUICommand("/vis/viewer/pan " + " 0. 10. mm")
def cmdDown(self, event):
gApplyUICommand("/vis/viewer/pan " + " 0. -10. mm")
def cmdRight(self, event):
gApplyUICommand("/vis/viewer/pan " + " -10. 0. mm")
def cmdLeft(self, event):
gApplyUICommand("/vis/viewer/pan " + " 10. 0. mm")
def ViewerSelected(self, event):
self.viewerName = event.GetString()
if self.viewerName == "OpenGL":
gApplyUICommand("/vis/viewer/select oglsxviewer")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
if self.viewerName == "VRML":
gApplyUICommand("/vis/viewer/select vrmlviewer")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
if self.viewerName == "Wired":
gApplyUICommand("/vis/viewer/select wired")
gApplyUICommand("/vis/scene/add/trajectories")
gApplyUICommand("/tracking/storeTrajectory 1")
gApplyUICommand("/vis/scene/endOfEventAction accumulate")
gApplyUICommand("/vis/scene/endOfRunAction accumulate")
# everytime wired is chosen, a new instance of wired is created
# to reuse single wired, g4pipe.poll() must be checked BEFORE the SECOND Popen
# if g4pipe.poll() == None:
g4pipe=Popen(heprepViewer+ " -file " + heprepDir+"/" +heprepName +".heprep", shell=True)
# not used
class MyText(wx.StaticText):
def __init__(self, parent, Text):
wx.StaticText.__init__(self, parent, -1, Text, pos=(20,20))
self.Bind(wx.EVT_LEFT_UP, self.ChangeColor)
def ChangeColor(self, event):
TheColour = self.GetForegroundColour()
if TheColour == (0,0,0):
self.SetLabel("Simulation is running!")
self.SetForegroundColour("red")
else:
self.SetLabel("Click me to start a run")
self.SetForegroundColour("black")
# to be used to choose materials and particles
# myList is a list of keys() of a dictionary
# f.e., materials are Python objects with their names as their keys
class SelectOne(wx.RadioBox):
def __init__(self, parent, myTitle, myList):
wx.RadioBox.__init__(self, parent, -1, myTitle, wx.DefaultPosition,
wx.DefaultSize, myList, 5, wx.RA_SPECIFY_ROWS)
# self.Bind(wx.EVT_RADIOBOX, self.Selected)
self.SetToolTip(wx.ToolTip("Select one"))
self.SetSelection(0)
# used only to test Bind and getValue
# def Selected(self, event):
# self.selected = event.GetString()
# used to %3.3f floating point number
# energy and length unit is given by unitList which must be a dictionary
# with units of Python objects and their name as their keys
class FloatCounter(wx.Panel):
def __init__(self, parent, myTitle, unitList):
wx.Panel.__init__(self, parent, -1)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.sizer.Add((10, -1))
self.sizer.Add(wx.StaticText(parent, -1, myTitle, wx.DefaultPosition, (100, -1)))
self.intPart = wx.SpinCtrl(parent, -1, "", wx.DefaultPosition, (60,-1))
self.intPart.SetRange(0,999)
self.intPart.SetValue(1)
self.intPart.Bind(wx.EVT_SPINCTRL, self.SetFloat)
self.manPart = wx.SpinCtrl(parent, -1, "", wx.DefaultPosition, (50, -1))
self.manPart.SetRange(0,999)
self.manPart.SetValue(0)
self.manPart.Bind(wx.EVT_SPINCTRL, self.SetFloat)
self.unitSel = wx.Choice(parent, -1, wx.DefaultPosition, (90, -1), unitList)
self.unitSel.Bind(wx.EVT_CHOICE, self.SetFloat, self.unitSel)
self.unitSel.SetSelection(2)
self.valAndUnit = wx.TextCtrl(parent, -1, "value unset", wx.DefaultPosition, (150, -1))
self.sizer.Add(self.valAndUnit)
self.sizer.Add((10, -1))
self.sizer.Add(wx.StaticText(parent, -1, " ", wx.DefaultPosition, (30, -1)))
self.sizer.Add(self.intPart)
self.sizer.Add(wx.StaticText(parent, -1, ".", wx.DefaultPosition, (10, -1)))
self.sizer.Add(self.manPart)
self.sizer.Add((5,-1))
self.sizer.Add(self.unitSel)
self.SetSizer(self.sizer)
def SetFloat(self, event):
self.theValueStr = str(self.intPart.GetValue()) + "." + str(self.manPart.GetValue()) + " "
self.theValue = float (self.intPart.GetValue()) + float(self.manPart.GetValue())/ 1000.
self.theUnit = self.unitSel.GetStringSelection()
theText = "%.3f" % (self.theValue) + " " + self.theUnit
self.valAndUnit.SetValue(theText)
# user may edit the Entry, so finnaly this value must be got
# but it doesn't work for length but work for energy (gApplyUIcommnd)
theTextWithStar = "%.3f" % (self.theValue) + " * " + self.theUnit
# special class for this example to set/unset processes
class Processes(wx.Panel):
def __init__(self, parent, myTitle, myList):
wx.Panel.__init__(self, parent, -1)
self.processCheck = {}
self.sizer = wx.FlexGridSizer(rows=5)
self.sizer.AddGrowableRow(1)
for item in myList:
self.processCheck[item] = wx.CheckBox(parent, -1, item)
self.processCheck[item].SetValue(True)
# self.processCheck[item].Bind(wx.EVT_CHECKBOX, self.CheckedProcess)
self.sizer.Add(self.processCheck[item],0,wx.EXPAND)
self.SetSizer(self.sizer)
self.SetBackgroundColour('green')
self.processState = {}
self.myList = myList
# test only
# def CheckedProcess(self, event):
# self.processName = event.GetEventObject().GetLabel()
# self.processState = event.GetEventObject().GetValue()
# slider to set an integer value
# title is shown
class Adjuster(wx.Panel):
def __init__(self, parent, myTitle, minVal, maxVal, initVal):
wx.Panel.__init__(self, parent, -1)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.sizer.Add((10, -1))
self.sizer.Add(wx.StaticText(parent, -1, myTitle, wx.DefaultPosition, (100, -1)))
self.slider = wx.Slider(parent, -1, initVal, minVal, maxVal,
wx.DefaultPosition, (300, -1),
wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
self.slider.SetPageSize(1)
self.sizer.Add(self.slider)
self.SetSizer(self.sizer)
# test only
# self.Bind(wx.EVT_SLIDER, self.Adjusted)
# def Adjusted(self, event):
# print self.GetValue()
########################## no use now
class Counter(wx.SpinCtrl):
def __init__(self, parent, myTitle, minVal, maxVal, initVal):
wx.SpinCtrl.__init__(self, parent, -1, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_RIGHT)
self.SetRange(minVal, maxVal)
self.SetValue(initVal)
self.Bind(wx.EVT_SPINCTRL, self.Adjusted)
def Adjusted(self, event):
print self.GetValue()
############################
# main class to instantiate the above classes and pack them using nested sizers
g4pipe=0
class MyApp(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Geant4Py")
self.nb = wx.Notebook(self, -1, wx.DefaultPosition, wx.DefaultSize,
style=
wx.NB_TOP # | wx.NB_MULTILINE
#wx.NB_BOTTOM
#wx.NB_LEFT
#wx.NB_RIGHT
)
self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging)
panel = wx.Panel(self.nb)
self.nb.AddPage(panel, "ExampleN03")
commandPanel = wx.Panel(self.nb)
self.nb.AddPage(commandPanel, "Geant4 Commands")
comP = ComPanel(commandPanel)
gxsizer = wx.BoxSizer(wx.HORIZONTAL)
gxsizer.Add(comP)
commandPanel.SetSizer(gxsizer)
visualizationPanel = wx.Panel(self.nb)
self.nb.AddPage(visualizationPanel, "Vis Commands")
visP = VisPanel(visualizationPanel)
vxsizer = wx.BoxSizer(wx.HORIZONTAL)
vxsizer.Add(visP)
visualizationPanel.SetSizer(vxsizer)
# outmost sizer in the vertical direction
bxsizer = wx.BoxSizer(wx.VERTICAL)
# nested sizer in the horizontal direction
bysizer = wx.BoxSizer(wx.HORIZONTAL)
self.runStart = wx.Button(panel, -1, " Run Start", wx.DefaultPosition, wx.DefaultSize)
self.Bind(wx.EVT_BUTTON, self.RunStart, self.runStart)
bxsizer.Add(self.runStart, 0, wx.ALL)
# widgets
absorberMaterialList = ['Aluminium', 'Lead']
self.theAbsorberMaterial = SelectOne(panel, "Absorber Materials", absorberMaterialList)
gapMaterialList = ["liquidArgon","Scintillator", "Air", "Aerogel", "Galactic"]
self.theGapMaterial = SelectOne(panel, "Gap Materials", gapMaterialList)
particleList = ["proton", "gamma", "e-", "e+", "mu-", "mu+"]
self.theParticle = SelectOne(panel, "Particles", particleList)
self.processList = ["phot", "compt", "conv", "msc", "eIoni", "eBrem", "annihil","muIoni", "muBrems", "hIoni"]
self.theProcesses = Processes(panel, "Processes", self.processList)
self.eventNo = Adjuster(panel, "Number of Events", 1 , 100 , 1)
self.layerNo = Adjuster(panel, "Number of Layers", 1, 10, 10)
self.lengthUnit = {'micrometer':micrometer, 'mm':mm, 'cm':cm, 'm':m}
self.absorberThickSpin = FloatCounter(panel, "Absorber Thickness", self.lengthUnit.keys())
self.gapThickSpin = FloatCounter(panel, "Gap Thickness", self.lengthUnit.keys())
self.sizeYZSpin = FloatCounter(panel, "Section Size", self.lengthUnit.keys())
self.cutLengthSpin = FloatCounter(panel, "Cut Length", self.lengthUnit.keys())
self.magneticUnit = {'Tesla':tesla, 'gauss':gauss, 'kilogauss':kilogauss}
self.magneticFieldSpin = FloatCounter(panel, "Magnetic Field", self.magneticUnit.keys())
self.energyUnit = { 'keV':keV, 'MeV':MeV, 'GeV':GeV, 'TeV':TeV, 'PeV':PeV}
self.energySpin = FloatCounter(panel, "incident beam energy", self.energyUnit.keys())
# now sizers
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bysizer.Add((10, -1))
bysizer.Add(self.theAbsorberMaterial, 0, wx.EXPAND, 10)
bysizer.Add((10, -1))
bysizer.Add(self.theGapMaterial, 0, wx.EXPAND, 10)
bysizer.Add((10, -1))
bysizer.Add(self.theParticle, 0, wx.EXPAND, 10)
bysizer.Add((10, -1))
bysizer.Add(self.theProcesses.sizer, 0, wx.EXPAND, 10)
bxsizer.Add(bysizer, 0, wx.EXPAND)
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bxsizer.Add(self.layerNo.sizer, 0, wx.EXPAND)
bxsizer.Add(self.absorberThickSpin.sizer, 0, wx.EXPAND)
bxsizer.Add(self.gapThickSpin.sizer, 0, wx.EXPAND)
bxsizer.Add(self.sizeYZSpin.sizer, 0, wx.EXPAND)
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bxsizer.Add(self.energySpin.sizer, 0, wx.EXPAND)
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bxsizer.Add(self.cutLengthSpin.sizer, 0, wx.EXPAND)
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bxsizer.Add(self.magneticFieldSpin.sizer, 0, wx.EXPAND)
bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
bxsizer.Add(self.eventNo.sizer, 0, wx.EXPAND)
# self.solid = EZgeom.G4EzVolume.GetSold(water_phantom)
# gControlExecute("oglx.mac")
panel.SetSizer(bxsizer)
bxsizer.Fit(self)
bxsizer.SetSizeHints(self)
def OnPageChanged(self, event):
old = event.GetOldSelection()
new = event.GetSelection()
sel = self.nb.GetSelection()
event.Skip()
def OnPageChanging(self, event):
old = event.GetOldSelection()
new = event.GetSelection()
sel = self.nb.GetSelection()
event.Skip()
def RunStart(self, event):
absorberTh = self.absorberThickSpin.theValue * self.lengthUnit[self.absorberThickSpin.theUnit]/2.0
gapTh = self.gapThickSpin.theValue * self.lengthUnit[self.gapThickSpin.theUnit]/2.0
yzSize = self.sizeYZSpin.theValue * self.lengthUnit[self.sizeYZSpin.theUnit]
print "BUG"
cutLen = self.cutLengthSpin.theValue * self.lengthUnit[self.cutLengthSpin.theUnit]
magF = self.magneticFieldSpin.theValue * self.magneticUnit[self.magneticFieldSpin.theUnit]
exN03geom.SetNbOfLayers(self.layerNo.slider.GetValue())
exN03geom.SetAbsorberMaterial(str(self.theAbsorberMaterial.GetStringSelection()))
exN03geom.SetAbsorberThickness(absorberTh)
exN03geom.SetGapMaterial(str(self.theGapMaterial.GetStringSelection()))
exN03geom.SetGapThickness(gapTh)
exN03geom.SetCalorSizeYZ(yzSize)
position = -self.layerNo.slider.GetValue() * ( absorberTh + gapTh )*1.2
exN03geom.UpdateGeometry()
exN03PL.SetDefaultCutValue(cutLen)
exN03PL.SetCutsWithDefault()
exN03geom.SetMagField(magF)
print "Now geometry updated"
print position
# gApplyUICommand("/vis/viewer/flush")
# gApplyUICommand("/vis/scene/add/text 0 610 610 mm 20 0 0 " + "wxPython")
gApplyUICommand("/gun/particle " + str ( self.theParticle.GetStringSelection() ) )
for i in self.processList:
# print i, self.theProcesses.processCheck[i].GetValue()
gProcessTable.SetProcessActivation(i, 1)
if self.theProcesses.processCheck[i].GetValue() != True:
gProcessTable.SetProcessActivation(i, 0)
gApplyUICommand("/gun/energy " + str ( self.energySpin.valAndUnit.GetValue() ) )
eventNum = self.eventNo.slider.GetValue()
for i in range(eventNum):
pg.SetParticlePosition(G4ThreeVector(position, (i-eventNum/2)*5.*mm, 0.*cm))
gRunManager.BeamOn(1)
# sleep(0.01)
gApplyUICommand("/vis/viewer/update")
app = wx.PySimpleApp(False)
MyApp().Show()
app.MainLoop()
+1 -1
View File
@@ -46,7 +46,7 @@ g4py.ParticleGun.Construct()
gRunManager.Initialize()
# visualization
gApplyUICommand("/vis/open OGLIX")
gApplyUICommand("/vis/open OGLSX")
gApplyUICommand("/vis/scene/create")
gApplyUICommand("/vis/scene/add/volume")
gApplyUICommand("/vis/sceneHandler/attach")
@@ -24,7 +24,7 @@ g4py.ParticleGun.Construct()
gRunManager.Initialize()
# visualization
gApplyUICommand("/vis/open OGLIX")
gApplyUICommand("/vis/open OGLSX")
gApplyUICommand("/vis/scene/create")
gApplyUICommand("/vis/scene/add/volume")
gApplyUICommand("/vis/sceneHandler/attach")
@@ -1,13 +1,15 @@
# - add libs components
set (G4SITEMODULES_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/g4py )
set(G4SITEMODULES_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/g4py)
include_directories (
${PYTHON_INCLUDE_PATH}
${BOOST_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${GEANT4_INCLUDE_DIR}
)
link_directories (${GEANT4_LIBRARY_DIR} ${Boost_LIBRARY_DIRS})
add_subdirectory(geometries)
add_subdirectory(materials)
add_subdirectory(processes)
@@ -1,20 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
include ../config/config.gmk
SUBDIR := geometries materials processes physics_lists primaries
SUBDIR += utils python
.PHONY: all install clean
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET ExN01geom)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := ExN01geom#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET ExN03geom)
add_library(
@@ -12,13 +10,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := ExN03geom#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,18 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
SUBDIR := Qgeom ExN01geom ExN03geom ezgeom
.PHONY: all install clean cleanlib
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET Qgeom)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := Qgeom#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET ezgeom)
add_library(
@@ -14,13 +12,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := ezgeom#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,18 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
SUBDIR := Qmaterials NISTmaterials
.PHONY: all install clean cleanlib
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET NISTmaterials)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := NISTmaterials#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET Qmaterials)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := Qmaterials#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET EMSTDpl)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := EMSTDpl#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET ExN01pl)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := ExN01pl#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET ExN03pl)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := ExN03pl#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,18 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
SUBDIR := ExN01pl ExN03pl EMSTDpl
.PHONY: all install clean
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
@@ -1,18 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
SUBDIR := ParticleGun MedicalBeam
.PHONY: all install clean cleanlib
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET MedicalBeam)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := MedicalBeam#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET ParticleGun)
add_library(
@@ -11,13 +9,15 @@ add_library(
)
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4SITEMODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := ParticleGun#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -1,18 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
SUBDIR := emcalculator
.PHONY: all install clean cleanlib
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
@@ -1,27 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
ifeq ($(Q_WITH_PYTHON3), 0)
install_dir := $(Q_LIBDIR)/g4py
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
include $(G4PY_INSTALL)/config/script-install.gmk
else
.PHONY: all install clean
all:
@cd python3 && $(MAKE)
install:
@cd python3 && $(MAKE) install
clean:
@cd python3 && $(MAKE) clean
endif
@@ -1,12 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../../config/config.gmk
install_dir := $(Q_LIBDIR)/g4py
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
include $(G4PY_INSTALL)/config/script-install.gmk
@@ -1,12 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../config/config.gmk
install_dir := $(Q_LIBDIR)/g4py
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
include $(G4PY_INSTALL)/config/script-install.gmk
@@ -1,18 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
SUBDIR := MCScore
.PHONY: all install clean cleanlib
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
@@ -1,27 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
ifeq ($(Q_WITH_PYTHON3), 0)
install_dir := $(Q_LIBDIR)/g4py
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
include $(G4PY_INSTALL)/config/script-install.gmk
else
.PHONY: all install clean
all:
@cd python3 && $(MAKE)
install:
@cd python3 && $(MAKE) install
clean:
@cd python3 && $(MAKE) clean
endif
@@ -1,12 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../../config/config.gmk
install_dir := $(Q_LIBDIR)/g4py
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
include $(G4PY_INSTALL)/config/script-install.gmk
+4 -3
View File
@@ -1,15 +1,16 @@
# - add libs components
set (G4MODULES_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/Geant4 )
set(G4MODULES_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/Geant4)
include_directories (
${PYTHON_INCLUDE_PATH}
${BOOST_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/source/boost
${GEANT4_INCLUDE_DIR}
)
link_directories (${GEANT4_LIBRARY_DIR} ${Boost_LIBRARY_DIRS})
add_subdirectory(global)
add_subdirectory(interface)
add_subdirectory(intercoms)
-33
View File
@@ -1,33 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../config/config.gmk
SUBDIR1 := global interface intercoms run event tracking track
SUBDIR1 += geometry materials particles processes digits_hits
SUBDIR2 := visualization graphics_reps physics_lists gdml
ifeq ($(Q_WITH_PYTHON3), 0)
SUBDIR3 := python
else
SUBDIR3 := python3
endif
.PHONY: all install clean
all:
@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE)); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE)); done;:
@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) install); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) install); done;:
@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) clean); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) clean); done;:
@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) clean); done;:
@@ -1,17 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../config/config.gmk
.PHONY: install
install:
@echo ... intall headers into $(Q_INCDIR)/boost
@if [ ! -d $(Q_INCDIR)/boost ]; then \
install -d $(Q_INCDIR)/boost; fi
@if [ ! -d $(Q_INCDIR)/boost/detail ]; then \
install -d $(Q_INCDIR)/boost/detail; fi
@install -m 644 *.hpp *.hh $(Q_INCDIR)/boost
@install -m 644 detail/*.hpp $(Q_INCDIR)/boost/detail
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET pyG4digits_hits)
add_library(
@@ -12,13 +10,16 @@ add_library(
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES OUTPUT_NAME "G4digits_hits")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4MODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../config/config.gmk
# python module name
MODULE := G4digits_hits#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET pyG4event)
add_library(
@@ -18,14 +16,15 @@ add_library(
set_target_properties (${_TARGET} PROPERTIES PREFIX "" )
set_target_properties(${_TARGET} PROPERTIES OUTPUT_NAME "G4event")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4MODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../config/config.gmk
# python module name
MODULE := G4event#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/install.gmk
+5 -3
View File
@@ -1,11 +1,11 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
if(GEANT4_HAS_GDML)
add_definitions(-DENABLE_GDML)
endif()
include_directories (${XERCESC_INCLUDE_DIRS})
# library
set(_TARGET pyG4gdml)
add_library(
@@ -16,13 +16,15 @@ add_library(
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES OUTPUT_NAME "G4gdml")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} ${XERCESC_LIBRARY}
boost_python ${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4MODULES_INSTALL_DIR})
-13
View File
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../config/config.gmk
# python module name
MODULE := G4gdml#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/install.gmk
@@ -1,7 +1,5 @@
# - build library
link_directories (${GEANT4_LIBRARY_DIR})
# library
set(_TARGET pyG4geometry)
add_library (
@@ -51,14 +49,15 @@ add_library (
set_target_properties(${_TARGET} PROPERTIES PREFIX "")
set_target_properties(${_TARGET} PROPERTIES OUTPUT_NAME "G4geometry")
set_target_properties(${_TARGET} PROPERTIES SUFFIX ".so")
set_target_properties(${_TARGET}
PROPERTIES INSTALL_RPATH
${GEANT4_LIBRARY_DIR}
BUILD_WITH_INSTALL_RPATH TRUE)
target_link_libraries (${_TARGET}
${GEANT4_LIBRARIES_WITH_VIS} boost_python)
${GEANT4_LIBRARIES_WITH_VIS} boost_python
${PYTHON_LIBRARIES})
# install
install(TARGETS ${_TARGET} LIBRARY DESTINATION ${G4MODULES_INSTALL_DIR})
@@ -1,13 +0,0 @@
# $Id: GNUmakefile 76884 2013-11-18 12:54:03Z gcosmo $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../config/config.gmk
# python module name
MODULE := G4geometry#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/install.gmk
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyG4EllipticalCone.cc 66892 2013-01-17 10:57:59Z gunter $
// $Id: pyG4EllipticalCone.cc 81291 2014-05-26 09:31:19Z gcosmo $
// ====================================================================
// pyG4EllipticalCone.cc
//
@@ -45,7 +45,7 @@ G4EllipticalCone* CreateEllipticalCone(const G4String& name,
G4double zMax,
G4double pzTopCut)
{
new G4EllipticalCone(name, pxSemiAxis,pySemiAxis, zMax, pzTopCut);
return new G4EllipticalCone(name, pxSemiAxis,pySemiAxis, zMax, pzTopCut);
}
}

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