Import Geant4 8.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:55:03 +02:00
parent 216a75eeb1
commit fe73f43734
6714 changed files with 118229 additions and 68144 deletions
+74 -104
View File
@@ -18,9 +18,9 @@
# you may fetch it yourself from your nearest archive site.)
#
# $Id: Configure,v 1.87 2006/06/28 11:24:25 stesting Exp $
# $Id: Configure,v 1.95 2006/12/15 15:19:44 stesting Exp $
#
# Generated on Wed Jun 28 13:14:07 CEST 2006 [metaconfig 3.0 PL70]
# Generated on Fri Dec 15 16:15:48 CET 2006 [metaconfig 3.0 PL70]
cat >/tmp/c1$$ <<EOF
WARNING!!!!!
@@ -172,7 +172,6 @@ g4ledata=''
g4levelgammadata=''
g4neutronhpcrosssections=''
g4radioactivedata=''
clhep_dirs=''
g4clhep_base_dir=''
g4clhep_include_dir=''
g4clhep_lib=''
@@ -1714,6 +1713,8 @@ case "$g4compiler" in
esac
esac
if [ X$g4system = X ] ; then
if [ X$g4build = Xyes ] ; then
while test 1 = 1 ; do
@@ -1845,7 +1846,6 @@ EOM
;;
esac
done
fi
#
@@ -1853,6 +1853,8 @@ fi
#
g4system=$g4osname-$g4compiler
fi
#cat << EOM
#
#G4SYSTEM is now set to $g4system.
@@ -2014,10 +2016,18 @@ fi
# Global libs
LDLIBS_1=`grep 'LDLIBS_FINAL :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed -e 's/^\(.*\):=//'`
LDLIBS_2=`echo $LDLIBS_1 | $sed -e 's/^\(.*\)-lMarker//'`
### LDLIBS_1=`grep 'LDLIBS_FINAL :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed -e 's/^\(.*\):=//'`
### LDLIBS_2=`echo $LDLIBS_1 | $sed -e 's/^\(.*\)-lMarker//'`
### echo "$LDLIBS_2 $c"
echo "$LDLIBS_2 $c"
LIBLIST_LIST=`$G4LIB/$G4SYSTEM/liblist -m $G4LIB/$G4SYSTEM < $G4LIB/$G4SYSTEM/libname.map`
LDLIBS3=`grep 'LDLIBS3 :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed -e 's/^\(.*\):=//'`
LDLIBS4=`grep 'LDLIBS4 :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed -e 's/^\(.*\):=//'`
LDLIBS=$LIBLIST_LIST $LDLIBS3 $LDLIBS4
echo $LDLIBS
# echo "-L$G4WORKDIR/lib/$G4SYSTEM -lG4persistency -lG4readout -lG4run -lG4event -lG4tracking -lG4parmodels -lG4processes -lG4digits+hits -lG4track -lG4particles -lG4geometry -lG4materials -lG4graphics_reps -lG4intercoms -lG4global $c"
@@ -2725,27 +2735,27 @@ esac
case "$g4radioactivedata" in
'')
g4radioactivedata=$g4data/RadiativeDecay3.0
g4radioactivedata=$g4data/RadioactiveDecay3.1
;;
esac
case "$g4ledata" in
'')
g4ledata=$g4data/G4EMLOW4.0
g4ledata=$g4data/G4EMLOW4.1
;;
esac
case "$g4neutronhpcrosssections" in
'')
g4neutronhpcrosssections=$g4data/G4NDL3.9
g4neutronhpcrosssections=$g4data/G4NDL3.10
;;
esac
case "$g4elasticdata" in
'')
g4elasticdata=$g4data/G4ELASTIC1.1
;;
esac
#case "$g4elasticdata" in
#'')
# g4elasticdata=$g4data/G4ELASTIC1.1
# ;;
#esac
#########################################################################
@@ -2763,8 +2773,6 @@ Please, specify default directory where ALL the Geant4 data is installed:
NeutronHPCrossSections: $g4neutronhpcrosssections
G4ELASTICDATA: $g4elasticdata
You will be asked about customizing these next.
EOM`
@@ -2784,10 +2792,10 @@ gans=$ans
g4data=$ans
g4levelgammadata=$g4data/PhotonEvaporation2.0
g4radioactivedata=$g4data/RadiativeDecay3.0
g4ledata=$g4data/G4EMLOW4.0
g4neutronhpcrosssections=$g4data/G4NDL3.9
g4elasticdata=$g4data/G4ELASTIC1.1
g4radioactivedata=$g4data/RadioactiveDecay3.1
g4ledata=$g4data/G4EMLOW4.1
g4neutronhpcrosssections=$g4data/G4NDL3.10
# g4elasticdata=$g4data/G4ELASTIC1.1
fi
# done
@@ -2807,8 +2815,6 @@ Please, specify default directory where the Geant4 data is installed:
4) NeutronHPCrossSections: $g4neutronhpcrosssections
5) G4ELASTICDATA: $g4elasticdata
To modify default settings, select number above (e.g. 2)
EOM`
@@ -2824,40 +2830,40 @@ gans=$ans
1)
dflt=$g4levelgammadata
fn='f~'
fn='d~'
rp="Where is Geant4 PhotonEvaporation2.0 data installed?"
. ./getfile
g4levelgammadata=$ans
;;
2)
dflt=$g4radioactivedata
fn='f~'
rp="Where is Geant4 RadiativeDecay3.0 data installed?"
fn='d~'
rp="Where is Geant4 RadioactiveDecay3.1 data installed?"
. ./getfile
g4radioactivedata=$ans
;;
3)
dflt=$g4ledata
fn='f~'
rp="Where is G4EMLOW4.0 data installed ?"
fn='d~'
rp="Where is G4EMLOW4.1 data installed ?"
. ./getfile
g4ledata=$ans
;;
4)
dflt=$g4neutronhpcrosssections
fn='f~'
rp="Where is G4NDL3.9 data installed?"
fn='d~'
rp="Where is G4NDL3.10 data installed?"
. ./getfile
g4neutronhpcrosssections=$ans
;;
5)
dflt=$g4elasticdata
fn='f~'
rp="Where is G4ELASTIC1.1 data installed?"
. ./getfile
g4elasticdata=$ans
;;
# 5)
# dflt=$g4elasticdata
# fn='d~'
# rp="Where is G4ELASTIC1.1 data installed?"
# . ./getfile
# g4elasticdata=$ans
# ;;
# [eE])
# break
@@ -2905,11 +2911,12 @@ fi
#while test 1 = 1 ; do
if test "X$g4clhep_base_dir" != "X" ; then
clhep_dirs=$g4clhep_base_dir
fi
#if test "X$g4clhep_base_dir" != "X" ; then
#clhep_dirs=$g4clhep_base_dir
#echo 1 g4clhep_base_dir=$g4clhep_base_dir
#fi
if test "X$clhep_dirs" != "X" ; then
if test "X$g4clhep_base_dir" != "X" ; then
g4message=`cat << EOM
@@ -3527,7 +3534,7 @@ fi # !Win
echo " "
case "$g4debug" in
'')
g4debug=""
g4debug=n
;;
esac
@@ -3543,7 +3550,7 @@ g4message=`cat << EOM
Do you want to compile libraries in DEBUG mode (-g)?
EOM`
dflt="n"
dflt=$g4debug
rp=$g4message
. ./myread
gans=$ans
@@ -3554,7 +3561,7 @@ gans=$ans
break
;;
y*|Y*)
g4debug=1
g4debug=y
break
;;
# [eE])
@@ -3865,7 +3872,7 @@ gans=$ans
if test "X$g4ui_build_xaw_session" = "Xy" ; then
if test "X$g4ui_xawhome" = "X" ; then
xaw_dirs=`find $g4ui_xawhome /usr/X11R6/include /usr/local/include /usr/include -type d -name Xaw 2>/dev/null |xargs echo`
xaw_dirs=`find $g4ui_xawhome /usr/X11R6/include /usr/local/include /usr/include /sw/include -type d -name Xaw 2>/dev/null |xargs echo`
#echo ogl_dirs=$ogl_dirs
if test "X$xaw_dirs" != "X" ; then
@@ -3890,17 +3897,14 @@ fi
##########################################################################
if test "X$g4ui_xawhome" != "X" ; then
xaw_dirs=$g4ui_xawhome
fi
#if test "X$g4ui_xawhome" != "X" ; then
#xaw_dirs=$g4ui_xawhome
#fi
if test "X$xaw_dirs" != "X" ; then
if test "X$g4ui_xawhome" != "X" ; then
g4message=`cat << EOM
XAW/include
XAW/lib
You have selected to use the XAW based user interfaces.
Specify the correct path where XAW is installed in your system.
It was found in $g4ui_xawhome. Press [Enter] to set this path or type the correct one.
@@ -3932,9 +3936,6 @@ else
g4message=`cat << EOM
XAW/include
XAW/lib
You have selected to use XAW based user interfaces.
But XAW was not found in $ans.
Please specify the correct path where XAW is installed in your system.
@@ -3954,9 +3955,6 @@ else
g4message=`cat << EOM
XAW/include
XAW/lib
You have selected to use XAW based user interfaces.
But XAW was not found in expected place.
Please specify the correct path where XAW is installed in your system.
@@ -3988,9 +3986,6 @@ else
g4message=`cat << EOM
XAW/include
XAW/lib
You have selected to use XAW based user interfaces.
But XAW was not found in $ans.
Please specify the correct path where XAW is installed in your system.
@@ -4100,7 +4095,7 @@ gans=$ans
if test "X$g4ui_build_xm_session" = "Xy" ; then
if test "X$g4vis_xmhome" = "X" ; then
xm_dirs=`find $g4vis_xmhome /usr/X11R6/include /usr/local/include /usr/include -type d -name Xm 2>/dev/null |xargs echo`
xm_dirs=`find $g4vis_xmhome /usr/X11R6/include /usr/local/include /usr/include /sw/include -type d -name Xm 2>/dev/null |xargs echo`
#echo ogl_dirs=$ogl_dirs
if test "X$xm_dirs" != "X" ; then
@@ -4124,17 +4119,14 @@ fi
##########################################################################
if test "X$g4vis_xmhome" != "X" ; then
xm_dirs=$g4vis_xmhome
fi
#if test "X$g4vis_xmhome" != "X" ; then
#xm_dirs=$g4vis_xmhome
#fi
if test "X$xm_dirs" != "X" ; then
if test "X$g4vis_xmhome" != "X" ; then
g4message=`cat << EOM
XM/include
XM/lib
You have selected to use the XM Motif based user interfaces.
Specify the correct path where Xm is installed in your system.
It was found in $g4vis_xmhome. Press [Enter] to set this path or type the correct one.
@@ -4166,9 +4158,6 @@ else
g4message=`cat << EOM
XM/include
XM/lib
You have selected to use XM Motif based user interfaces.
But XM Motif was not found in $ans.
Please specify the correct path where Xm is installed in your system.
@@ -4188,9 +4177,6 @@ else
g4message=`cat << EOM
XM/include
XM/lib
You have selected to use XM Motif based user interfaces.
But XM Motif was not found in expected place.
Please specify the correct path where Xm is installed in your system.
@@ -4222,9 +4208,6 @@ else
g4message=`cat << EOM
XM/include
XM/lib
You have selected to use XM Motif based user interfaces.
But XM Motif was not found in $ans.
Please specify the correct path where Xm is installed in your system.
@@ -4624,7 +4607,7 @@ if test "X$g4vis_build_openglxm_driver" = "Xy" ; then
#echo PASS2
if test "X$g4vis_xmhome" = "X" ; then
xm_dirs=`find $g4vis_xmhome /usr/X11R6/include /usr/local/include /usr/include -type d -name Xm 2>/dev/null |xargs echo`
xm_dirs=`find $g4vis_xmhome /usr/X11R6/include /usr/local/include /usr/include /sw/include -type d -name Xm 2>/dev/null |xargs echo`
#echo ogl_dirs=$ogl_dirs
if test "X$xm_dirs" != "X" ; then
@@ -4648,17 +4631,14 @@ fi
##########################################################################
if test "X$g4vis_xmhome" != "X" ; then
xm_dirs=$g4vis_xmhome
fi
#if test "X$g4vis_xmhome" != "X" ; then
#xm_dirs=$g4vis_xmhome
#fi
if test "X$xm_dirs" != "X" ; then
if test "X$g4vis_xmhome" != "X" ; then
g4message=`cat << EOM
XM/include
XM/lib
You have selected to use OPENGLXM driver.
Specify the correct path where Xm is installed in your system.
It was found in $g4vis_xmhome. Press [Enter] to set this path or type the correct one.
@@ -4690,9 +4670,6 @@ else
g4message=`cat << EOM
XM/include
XM/lib
You have selected to use OPENGLXM driver.
But it was not found in $ans.
Please specify the correct path where Xm is installed in your system.
@@ -4712,9 +4689,6 @@ else
g4message=`cat << EOM
XM/include
XM/lib
You have selected to use OPENGLXM driver.
But it was not found in expected place.
Please specify the correct path where Xm is installed in your system.
@@ -4746,9 +4720,6 @@ else
g4message=`cat << EOM
XM/include
XM/lib
You have selected to use OPENGLXM driver.
But it was not found in $ans.
Please specify the correct path where Xm is installed in your system.
@@ -4945,11 +4916,11 @@ fi
##########################################################################
if test "X$g4vis_oivhome" != "X" ; then
oiv_dirs=$g4vis_oivhome
fi
#if test "X$g4vis_oivhome" != "X" ; then
#oiv_dirs=$g4vis_oivhome
#fi
if test "X$oiv_dirs" != "X" ; then
if test "X$g4vis_oivhome" != "X" ; then
g4message=`cat << EOM
@@ -5159,11 +5130,11 @@ fi
##########################################################################
if test "X$g4vis_oivhome" != "X" ; then
oiv_dirs=$g4vis_oivhome
fi
#if test "X$g4vis_oivhome" != "X" ; then
#oiv_dirs=$g4vis_oivhome
#fi
if test "X$oiv_dirs" != "X" ; then
if test "X$g4vis_oivhome" != "X" ; then
g4message=`cat << EOM
@@ -5837,7 +5808,6 @@ State='$State'
c='$c'
cf_by='$cf_by'
cf_time='$cf_time'
clhep_dirs='$clhep_dirs'
contains='$contains'
d_portable='$d_portable'
eunicefix='$eunicefix'
+85
View File
@@ -0,0 +1,85 @@
Geant4 8.1 - patch-01 Release Notes
-----------------------------------
27 July 2006
List of fixes included in this public patch since the public release 8.1:
o Geometry:
--------
+ management
o Fixed problem in G4Region::ScanVolumeTree() for volume scanning
related to nested parameterisations.
o Particles:
---------
+ Code cleanup for G4PrimaryVertex class.
o Electromagnetic processes:
-------------------------
+ muons:
o G4EnergyLossForExtrapolator: fixed misprint in name for method
EnergyDispersion().
+ utils:
o Do not clear loss table map in G4LossTableManager to avoid crash
for activation/desactivation of regime with ion gun.
Propagating 'RandomStep' flag to processes.
o Hadronic Processes:
------------------
+ models/chiral_inv_phase_space/body:
o Bug fix in QGSC for redefenition of Chipolino.
o Fixed light Cone Boost bug, causing the error message from vectors.
+ models/coherent_elastic:
o Fixed problem in rotation of final state which needs to be done in
PostStep of the process and not at model level.
o Removed 1 keV limit from G4UHadronElasticProcess.
+ models/radioactive_decay
o G4NuclearDecayChannel::BetaDecayIt(): make additional check for
negative sqrt() argument in 'daughtermomentum[1]'.
o Physics Lists:
-------------
+ Fixed initialisation problem for QBBC_HP
+ Corrected flag for HP regime in G4HadronElasticPhysics() to be 'true'
for LHEP_HP and QGSP_HP.
+ Added G4NeutronHPElasticData in HP physics lists for hadron elastic
physics.
+ Added cout of list of processes and models for QBBC.
o Examples:
--------
+ Updated reference outputs.
+ advanced/composite_calorimeter
o Updated hadronic physics list to be consistent with validation runs.
+ advanced/lAr_calorimeter
o Updated hadronic physics list to be consistent with validation runs.
o Fixed few problems of use of non-initialised variables.
o Fixed compilation problems on gcc-4.X.
+ advanced/hadrontherapy
o Corrected hadronic physics list for Precompund model.
+ advanced/radioprotection
o Added missing inclusion of G4UItcsh.hh inside main().
+ extended/eventgenerator/HepMC
o Updated physics lists to conform with non-static particles.
+ extended/parallel/ParN02
+ extended/parallel/ParN04
o Updated physics lists to conform with non-static particles.
----------------------------------------------------------------------------
Technical Notes
---------------
o This patch should be applied on top of release 8.1.
o Technical notes distributed for release 8.1 are also applicable and
valid for this patch.
The code and rebuilt binary libraries for release 8.1 are available through
our "Source Code" Web page: http://cern.ch/geant4
Please refer to the Geant4 User Documentation:
http://cern.ch/geant4/G4UsersDocuments/Overview/html
for further information about using Geant4.
+112
View File
@@ -0,0 +1,112 @@
Geant4 8.1 - patch-02 Release Notes
-----------------------------------
10 November 2006
List of fixes included in this public patch since the public release 8.1.p01:
o Geometry:
--------
+ management
o Added empty virtual method CheckOverlaps() to G4VPhysicalVolume to
allow for proper overloading from subclasses. Implementation returns
always 'false', which is the case for replicas.
o Global:
------
+ Corrected inclusion of CLHEP headers in wrapper files
G4SystemOfUnits.hh and G4PhysicalConstants.hh.
o Electromagnetic processes:
-------------------------
+ standard:
o Fixed energy non-conservation in G4PAIModel for positrons. Fix also
concerning 'Tmax' for electrons and positrons: 'Tmax' is defined
now for each particle independently.
o Fixed problem of positron zero incident energy in G4eeToTwoGammaModel.
o Added extra protection inside G4BetheBlochModel.
o Fixed problems and add comments in the classes prototype Coulomb
elastic scattering: G4CoulombScattering, G4CoulombScatteringModel,
G4eCoulombScatteringModel. Set default limit on scattering angle to
zero.
+ utils:
o G4VEnergyLossProcess: made LambdaPhysicsVector() method protected.
o G4ionEffectiveCharge: added protection for NULL pointer to material.
o Hadronic Processes:
------------------
+ models/coherent_elastic:
o Introduced NaN check inside G4HadronElastic, G4ChargeExchange, and
G4UHadronElasticProcess.
o Removed HP data from G4UHadronElasticProcess (it is set in physics
lists); added low energy threshold of 20 MeV in G4HadronElastic for
QElastic. For any particle with kinetic energy below 10 KeV, the
primary particle is returned unchanged and no scattering is sampled.
This prevents situations of low-energy neutrons scattering forever,
and reduces precision in computing scattering for low-energy hadrons.
+ models/utils:
o Reduced warning output from G4Fragment on negative excitation energy;
a maximum of 10 warnings is printed now.
o G4Fancy3DNucleus:ChoosePositions(): correctly use std::vector.
Correction addressing problem report #887 on WIN32/VC8.
o Removed meaningless 'const' qualifier from return type of method
G4Fancy3DNucleusHelper().
o Particles:
---------
+ Fixed bug in G4ParticleDefinition constructor causing not filling quark
contents when G4VERBOSE is not set.
+ Fixed bug in k2(1770) decay. Addresses problem report #894.
o Persistency:
-----------
+ Get Rid of useless forward declarations in G4MCTEvent and
G4MCTGenParticle header files. Clearing compilation warnings on
icc-9.X compilers.
o Track:
-----
+ Made G4StepPoint::operator=() inline for optimisation.
o Physics Lists:
-------------
+ G4HadronElasticPhysics: added explicit inclusions of data headers
in the header file.
o Configuration:
-------------
+ Linux-icc: updated setup to support Intel icc compiler 9.X series.
+ liblist.c: added .dylib search for list of libraries.
Addressing problem report #885.
+ architecture.gmk: added variables for commands: echo, cat, cut, sed;
to be eventually overloaded in system dependent configurations.
Overloaded variables for WIN32-VC to force usage of the original
CygWin built-in commands. Use standard 'echo' command for Darwin-g++.
Replaced system commands with variables defined at architecture level
in source/GNUmakefile.
o Examples:
--------
+ Updated reference outputs.
+ advanced/underground_physics
o Fixed bug: removed uninitialized 'UserLimitsForXenon'.
+ extended/analysis/AnaEx01
o Corrected text in README for AIDA setup.
----------------------------------------------------------------------------
Technical Notes
---------------
o This patch should be applied on top of release 8.1.p01
o Technical notes distributed for release 8.1 are also applicable and
valid for this patch.
The code and rebuilt binary libraries for release 8.1.p02 are available
through our "Source Code" Web page:
http://cern.ch/geant4/support/download.shtml
Please refer to the Geant4 User Documentation:
http://cern.ch/geant4/support/userdocuments.shtml
for further information about using Geant4.
File diff suppressed because it is too large Load Diff
+32 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.278 2006/06/13 15:37:35 gcosmo Exp $
$Id: History,v 1.288 2006/11/30 15:47:16 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,37 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
3rd November 2006 Gunter Folger (config-V08-01-07)
- architecture.gmk: added G4LIB_BUILD_LISTS with default value 1 to build physics lists.
- binmake.gmk: added physics lists include directories to INCFLAGS.
15th October 2006 Makoto Asai (config-V08-01-06)
- binmake.gmk: added 'processes/scoring' module.
10th October 2006 Gabriele Cosmo (config-V08-01-05)
- Darwin-g++.gmk: use standard -echo- command.
Removed ECHO overloaded variable.
5th October 2006 Gabriele Cosmo (config-V08-01-04)
- liblist.c: added .dylib search for list of libraries.
Addressing problem report #885.
3rd October 2006 Gabriele Cosmo (config-V08-01-03)
- architecture.gmk: added variables for commands: echo, cat, cut, sed;
to be eventually overloaded in system dependent configurations.
- WIN32-VC.gmk: overload commands [echo, grep, cat, cut, sed], to force
usage of the original CygWin built-in commands.
21st September 2006 Vladimir Ivantchenko (config-V08-01-02)
- binmake.gmk: added electromagnetic/polarisation module.
18th August 2006 Gabriele Cosmo (config-V08-01-01)
- Linux-icc: corrected G4RUNPATHOPTION flag to allow linking of applications
with shared libraries.
18th August 2006 Gabriele Cosmo (config-V08-01-00)
- Linux-icc: updated setup to support icc-9.X series.
13th June 2006 Gabriele Cosmo (config-V08-00-02)
- Removed defaults for X11, XM, XAW flags in architecture.gmk and added
explicit settings in sys/*.gmk setups protected by ifndef statements for
+21 -3
View File
@@ -1,4 +1,4 @@
# $Id: architecture.gmk,v 1.105 2006/06/13 15:36:30 gcosmo Exp $
# $Id: architecture.gmk,v 1.107 2006/10/31 11:35:43 gunter Exp $
# ------------------------------------------------------------------------
# GEANT 4 - Architecture configuration script for GNU Make
#
@@ -112,6 +112,12 @@ ifneq ($(G4LIB_BUILD_ZLIB),)
G4LIB_USE_ZLIB = 1
endif
# Allow to disable building of physics_lists module. Default is to build these
#
ifneq ($(G4LIB_BUILD_LISTS),NO)
G4LIB_BUILD_LISTS = 1
endif
# If not specified, the default path for G4 binaries G4BIN is
# set to $G4WORKDIR/bin/$G4SYSTEM ...
#
@@ -267,14 +273,26 @@ G4TREP := $(G4TMP)/$(G4TEMPLATE_REPOSITORY)
#
AR := ar r
# Default echo used with makedepend. Changed for SUN-CC, Linux-g++.
# Default echo used with makedepend. Changed for SUN-CC, Linux-g++, WIN32.
#
ECHO:= echo
# Default grep used with source/GNUmakfile. Changed for SUN-CC.
# Default grep used with source/GNUmakefile. Changed for SUN-CC.
#
GREP := grep
# Default cut used with source/GNUmakefile. Changed for WIN32.
#
CUT := cut
# Default cat used with source/GNUmakefile. Changed for WIN32.
#
CAT := cat
# Default sed used with source/GNUmakefile. Changed for WIN32.
#
SED := sed
# Include architecture dependent setups...
#
include $(G4INSTALL)/config/sys/$(G4SYSTEM).gmk
+12 -3
View File
@@ -1,4 +1,4 @@
# $Id: binmake.gmk,v 1.112 2006/04/24 10:54:18 gcosmo Exp $
# $Id: binmake.gmk,v 1.116 2006/11/08 16:52:19 gunter Exp $
# ----------------------------------------------------------
# Script defining rules and paths for making binaries.
# First implementation: Gabriele Cosmo, 25/06/1998.
@@ -60,8 +60,11 @@ ifndef INCFLAGS
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/shortlived/include \
-I$(G4BASE)/physics_lists/lists/include \
-I$(G4BASE)/physics_lists/builders/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/scoring/include \
-I$(G4BASE)/processes/decay/include \
-I$(G4BASE)/processes/optical/include \
-I$(G4BASE)/processes/transportation/include \
@@ -72,6 +75,7 @@ ifndef INCFLAGS
-I$(G4BASE)/processes/electromagnetic/xrays/include \
-I$(G4BASE)/processes/electromagnetic/lowenergy/include \
-I$(G4BASE)/processes/electromagnetic/highenergy/include \
-I$(G4BASE)/processes/electromagnetic/polarisation/include \
-I$(G4BASE)/processes/hadronic/cross_sections/include \
-I$(G4BASE)/processes/hadronic/management/include \
-I$(G4BASE)/processes/hadronic/models/abrasion/include \
@@ -202,8 +206,13 @@ ifdef GLOBALLIBS
LDLIBS2 += -lG3toG4
endif
LDLIBS2 += -lG4readout \
-lG4run \
LDLIBS2 += -lG4readout
ifeq ($(G4LIB_BUILD_LISTS),1)
LDLIBS2 += -lG4physicslists
endif
LDLIBS2 += -lG4run \
-lG4event \
-lG4tracking \
-lG4parmodels \
+9 -1
View File
@@ -1,4 +1,4 @@
/* $Id: liblist.c,v 1.17 2002/11/22 11:53:10 gcosmo Exp $ */
/* $Id: liblist.c,v 1.18 2006/10/05 14:22:06 gcosmo Exp $ */
/*
Given a "libname.map" file on standard input and a list or directory
@@ -549,6 +549,14 @@ int main (int argc, char** argv) {
{
printf("-l%s ",libmapPtr->lib);
}
else /* case MacOS .dylib */
{
sprintf(libname, "%s/lib%s.dylib", libpath, libmapPtr->lib);
if (!access(libname,R_OK))
{
printf("-l%s ",libmapPtr->lib);
}
}
}
else
{
+94 -6
View File
@@ -22,6 +22,61 @@ esac
: Protect any dollar signs and backticks that you do not want interpreted
: by putting a backslash in front. You may delete these comments.
$spitshell >env.csh <<!GROK!THIS!
######################################
#
# Clean all G4 envs
unsetenv CLHEP_BASE_DIR
unsetenv CLHEP_INCLUDE_DIR
unsetenv CLHEP_LIB
unsetenv CLHEP_LIB_DIR
unsetenv G4ANALYSIS_USE
unsetenv G4DEBUG
unsetenv G4INCLUDE
unsetenv G4INSTALL
unsetenv G4LEDATA
unsetenv G4LEVELGAMMADATA
unsetenv NeutronHPCrossSections
unsetenv G4RADIOACTIVEDATA
unsetenv G4LIB
unsetenv G4LIB_BUILD_G3TOG4
unsetenv G4LIB_BUILD_SHARED
unsetenv G4LIB_BUILD_STATIC
unsetenv G4LIB_BUILD_ZLIB
unsetenv G4LIB_USE_G3TOG4
unsetenv G4LIB_USE_GRANULAR
unsetenv G4LIB_USE_ZLIB
unsetenv G4SYSTEM
unsetenv G4UI_BUILD_WIN32_SESSION
unsetenv G4UI_BUILD_XAW_SESSION
unsetenv G4UI_BUILD_XM_SESSION
unsetenv G4UI_USE_TCSH
unsetenv G4UI_USE_WIN32
unsetenv G4UI_USE_XAW
unsetenv G4UI_USE_XM
unsetenv G4VIS_BUILD_DAWN_DRIVER
unsetenv G4VIS_BUILD_OIWIN32_DRIVER
unsetenv G4VIS_BUILD_OIX_DRIVER
unsetenv G4VIS_BUILD_OPENGLWIN32_DRIVER
unsetenv G4VIS_BUILD_OPENGLXM_DRIVER
unsetenv G4VIS_BUILD_OPENGLX_DRIVER
unsetenv G4VIS_BUILD_RAYTRACERX_DRIVER
unsetenv G4VIS_BUILD_VRML_DRIVER
unsetenv G4VIS_USE_DAWN
unsetenv G4VIS_USE_OIWIN32
unsetenv G4VIS_USE_OIX
unsetenv G4VIS_USE_OPENGLWIN32
unsetenv G4VIS_USE_OPENGLX
unsetenv G4VIS_USE_OPENGLXM
unsetenv G4VIS_USE_RAYTRACERX
unsetenv G4VIS_USE_VRML
######################################
#
# g4system.U
@@ -90,10 +145,10 @@ echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
endif
#+
if ( X$g4elasticdata != X ) then
setenv G4ELASTICDATA "$g4elasticdata"
echo "On this machine the G4ELASTICDATA=\$G4ELASTICDATA"
endif
#if ( X$g4elasticdata != X ) then
#setenv G4ELASTICDATA "$g4elasticdata"
#echo "On this machine the G4ELASTICDATA=\$G4ELASTICDATA"
#endif
#
# g4clhep.U
@@ -125,8 +180,8 @@ endif
#
# g4debug
#
if ( X$g4debug != X ) then
setenv G4DEBUG "$g4debug"
if ( X$g4debug == Xy ) then
setenv G4DEBUG 1
echo "On this machine the G4DEBUG=\$G4DEBUG"
endif
@@ -416,13 +471,46 @@ endif
# Shared libraries
#
if ( ${?G4LIB_BUILD_SHARED} ) then
#
# Warning about LD_LIBRARY_PATH
#
echo ''
echo 'LD_LIBRARY_PATH is set to include CLHEP and Geant4 libraries. '
echo ''
echo 'NOTE : verify that the correct path for the CLHEP library'
echo '- $CLHEP_BASE_DIR/lib - is included in the $LD_LIBRARY_PATH'
echo 'variable in your environment, and no other outdated installations'
echo 'of CLHEP are by chance referenced through $LD_LIBRARY_PATH and'
echo 'present in your system !'
echo ''
if ( ${?LD_LIBRARY_PATH} ) then
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
else
setenv LD_LIBRARY_PATH ${G4LIB}/${G4SYSTEM}
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
endif
endif
#
# Shared libraries for Mac
#
if ( "X$G4SYSTEM" == "XDarwin-g++" ) then
if ( ${?G4LIB_BUILD_SHARED} ) then
if ( ${?DYLD_LIBRARY_PATH} ) then
setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
else
setenv DYLD_LIBRARY_PATH ${G4LIB}/${G4SYSTEM}
setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
endif
endif
endif
#
# For BIN
#
+115 -14
View File
@@ -23,6 +23,61 @@ esac
: by putting a backslash in front. You may delete these comments.
$spitshell >env.sh <<!GROK!THIS!
######################################
#
# Clean all G4 envs
unset CLHEP_BASE_DIR
unset CLHEP_INCLUDE_DIR
unset CLHEP_LIB
unset CLHEP_LIB_DIR
unset G4ANALYSIS_USE
unset G4DEBUG
unset G4INCLUDE
unset G4INSTALL
unset G4LEDATA
unset G4LEVELGAMMADATA
unset NeutronHPCrossSections
unset G4RADIOACTIVEDATA
unset G4LIB
unset G4LIB_BUILD_G3TOG4
unset G4LIB_BUILD_SHARED
unset G4LIB_BUILD_STATIC
unset G4LIB_BUILD_ZLIB
unset G4LIB_USE_G3TOG4
unset G4LIB_USE_GRANULAR
unset G4LIB_USE_ZLIB
unset G4SYSTEM
unset G4UI_BUILD_WIN32_SESSION
unset G4UI_BUILD_XAW_SESSION
unset G4UI_BUILD_XM_SESSION
unset G4UI_USE_TCSH
unset G4UI_USE_WIN32
unset G4UI_USE_XAW
unset G4UI_USE_XM
unset G4VIS_BUILD_DAWN_DRIVER
unset G4VIS_BUILD_OIWIN32_DRIVER
unset G4VIS_BUILD_OIX_DRIVER
unset G4VIS_BUILD_OPENGLWIN32_DRIVER
unset G4VIS_BUILD_OPENGLXM_DRIVER
unset G4VIS_BUILD_OPENGLX_DRIVER
unset G4VIS_BUILD_RAYTRACERX_DRIVER
unset G4VIS_BUILD_VRML_DRIVER
unset G4VIS_USE_DAWN
unset G4VIS_USE_OIWIN32
unset G4VIS_USE_OIX
unset G4VIS_USE_OPENGLWIN32
unset G4VIS_USE_OPENGLX
unset G4VIS_USE_OPENGLXM
unset G4VIS_USE_RAYTRACERX
unset G4VIS_USE_VRML
#
# g4system.U
#
@@ -116,13 +171,13 @@ fi
fi
#+
if [ X$g4elasticdata != X ] ; then
G4ELASTICDATA="$g4elasticdata"
export G4ELASTICDATA
if [ X\$g4non_display = X ] ; then
echo "On this machine the G4ELASTICDATA=\$G4ELASTICDATA"
fi
fi
#if [ X$g4elasticdata != X ] ; then
#G4ELASTICDATA="$g4elasticdata"
#export G4ELASTICDATA
#if [ X\$g4non_display = X ] ; then
#echo "On this machine the G4ELASTICDATA=\$G4ELASTICDATA"
#fi
#fi
#
# g4clhep.U
@@ -166,8 +221,8 @@ fi
#
# g4debug
#
if [ X$g4debug != X ] ; then
G4DEBUG="$g4debug"
if [ X$g4debug = Xy ] ; then
G4DEBUG=1
export G4DEBUG
if [ X\$g4non_display = X ] ; then
echo "On this machine the G4DEBUG=\$G4DEBUG"
@@ -489,14 +544,18 @@ fi
if [ X$g4wlib_build_zlib = Xy ] ; then
G4LIB_BUILD_ZLIB=1
export G4LIB_BUILD_ZLIB
if [ X\$g4non_display = X ] ; then
echo "On this machine the G4LIB_BUILD_ZLIB=\$G4LIB_BUILD_ZLIB"
fi
fi
if [ X$g4w_use_zlib = Xy ] ; then
G4LIB_USE_ZLIB=1
export G4LIB_USE_ZLIB
if [ X\$g4non_display = X ] ; then
echo "On this machine the G4LIB_USE_ZLIB=\$G4LIB_USE_ZLIB"
fi
fi
#+
@@ -560,43 +619,85 @@ if [ $G4WORKDIR ] ; then
if [ X$g4non_display = X ] ; then
echo "In your environment you have the G4WORKDIR=$G4WORKDIR"
fi # if non_display
fi
else
if [ X$g4non_display = X ] ; then
# Check for Windows!
if test "X$G4SYSTEM" = "XWIN32-VC" -o "X$G4SYSTEM" = "XWIN32-VC7"; then
if [ X$g4non_display = X ] ; then
echo "G4WORKDIR will be set to c:/geant4 (in "native" Windows syntax)"
fi
G4WORKDIR="c:/geant4"
export G4WORKDIR
else # if Unix
if [ X$g4non_display = X ] ; then
echo "G4WORKDIR will be set to HOME/geant4=$HOME/geant4"
export G4WORKDIR=$HOME/geant4
fi
G4WORKDIR=$HOME/geant4
export G4WORKDIR
fi # if platforms
fi
fi
#
# Shared libraries
#
if [ $G4LIB_BUILD_SHARED ] ; then
#
# Warning about LD_LIBRARY_PATH
#
if [ X$g4non_display = X ] ; then
echo ''
echo 'LD_LIBRARY_PATH is set to include CLHEP and Geant4 libraries. '
echo ''
echo 'NOTE : verify that the correct path for the CLHEP library'
echo '- $CLHEP_BASE_DIR/lib - is included in the $LD_LIBRARY_PATH'
echo 'variable in your environment, and no other outdated installations'
echo 'of CLHEP are by chance referenced through $LD_LIBRARY_PATH and'
echo 'present in your system !'
echo ''
fi
if [ $LD_LIBRARY_PATH ] ; then
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
export LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=${G4LIB}/${G4SYSTEM}
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
export LD_LIBRARY_PATH
fi
fi
#
# Shared libraries for Mac
#
if test "X$G4SYSTEM" = "XDarwin-g++" ; then
if [ $G4LIB_BUILD_SHARED ] ; then
if [ $DYLD_LIBRARY_PATH ] ; then
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
export DYLD_LIBRARY_PATH
else
DYLD_LIBRARY_PATH=${G4LIB}/${G4SYSTEM}
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${CLHEP_BASE_DIR}/lib
export DYLD_LIBRARY_PATH
fi
fi
fi
#
# For BIN
#
+62 -7
View File
@@ -22,6 +22,61 @@ esac
: Protect any dollar signs and backticks that you do not want interpreted
: by putting a backslash in front. You may delete these comments.
$spitshell >install.sh <<!GROK!THIS!
######################################
#
# Clean all G4 envs
unset CLHEP_BASE_DIR
unset CLHEP_INCLUDE_DIR
unset CLHEP_LIB
unset CLHEP_LIB_DIR
unset G4ANALYSIS_USE
unset G4DEBUG
unset G4INCLUDE
unset G4INSTALL
unset G4LEDATA
unset G4LEVELGAMMADATA
unset NeutronHPCrossSections
unset G4RADIOACTIVEDATA
unset G4LIB
unset G4LIB_BUILD_G3TOG4
unset G4LIB_BUILD_SHARED
unset G4LIB_BUILD_STATIC
unset G4LIB_BUILD_ZLIB
unset G4LIB_USE_G3TOG4
unset G4LIB_USE_GRANULAR
unset G4LIB_USE_ZLIB
unset G4SYSTEM
unset G4UI_BUILD_WIN32_SESSION
unset G4UI_BUILD_XAW_SESSION
unset G4UI_BUILD_XM_SESSION
unset G4UI_USE_TCSH
unset G4UI_USE_WIN32
unset G4UI_USE_XAW
unset G4UI_USE_XM
unset G4VIS_BUILD_DAWN_DRIVER
unset G4VIS_BUILD_OIWIN32_DRIVER
unset G4VIS_BUILD_OIX_DRIVER
unset G4VIS_BUILD_OPENGLWIN32_DRIVER
unset G4VIS_BUILD_OPENGLXM_DRIVER
unset G4VIS_BUILD_OPENGLX_DRIVER
unset G4VIS_BUILD_RAYTRACERX_DRIVER
unset G4VIS_BUILD_VRML_DRIVER
unset G4VIS_USE_DAWN
unset G4VIS_USE_OIWIN32
unset G4VIS_USE_OIX
unset G4VIS_USE_OPENGLWIN32
unset G4VIS_USE_OPENGLX
unset G4VIS_USE_OPENGLXM
unset G4VIS_USE_RAYTRACERX
unset G4VIS_USE_VRML
######################################
#
# g4system.U
@@ -95,11 +150,11 @@ echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
fi
#+
if [ X$g4elasticdata != X ] ; then
G4ELASTICDATA="$g4elasticdata"
export G4ELASTICDATA
echo "On this machine the G4ELASTICDATA=\$g4elasticdata"
fi
#if [ X$g4elasticdata != X ] ; then
#G4ELASTICDATA="$g4elasticdata"
#export G4ELASTICDATA
#echo "On this machine the G4ELASTICDATA=\$g4elasticdata"
#fi
#
# g4clhep.U
@@ -141,8 +196,8 @@ fi
#
# g4debug
#
if [ X$g4debug != X ] ; then
G4DEBUG="$g4debug"
if [ X$g4debug = Xy ] ; then
G4DEBUG=1
export G4DEBUG
echo "On this machine the G4DEBUG=\$G4DEBUG"
fi
+7 -7
View File
@@ -95,11 +95,11 @@ echo "On this machine the NeutronHPCrossSections=\$NeutronHPCrossSections"
fi
#+
if [ X$g4elasticdata != X ] ; then
G4ELASTICDATA="$g4elasticdata"
export G4ELASTICDATA
echo "On this machine the G4ELASTICDATA=\$G4ELASTICDATA"
fi
#if [ X$g4elasticdata != X ] ; then
#G4ELASTICDATA="$g4elasticdata"
#export G4ELASTICDATA
#echo "On this machine the G4ELASTICDATA=\$G4ELASTICDATA"
#fi
#
# g4clhep.U
@@ -135,8 +135,8 @@ fi
#
# g4debug
#
if [ X$g4debug != X ] ; then
G4DEBUG="$g4debug"
if [ X$g4debug = Xy ] ; then
G4DEBUG=1
export G4DEBUG
echo "On this machine the G4DEBUG=\$G4DEBUG"
fi
-1
View File
@@ -31,7 +31,6 @@ ifeq ($(G4SYSTEM),Darwin-g++)
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
LDFLAGS += -bind_at_load
FCLIBS := -lg2c -lnsl
ECHO := /bin/echo -n
SHEXT := dylib
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
+8 -7
View File
@@ -1,13 +1,13 @@
#
# ------ GNU/LINUX ------ !!! not supported !!!
# Intel icc 8.0
# ------ GNU/LINUX ------ Intel icc 9.1
#
ifeq ($(G4SYSTEM),Linux-icc)
CXX := icc
CXXFLAGS := -ansi -mp -no-gcc -w1
ifdef G4OPTIMISE
CXXFLAGS += -O
FCFLAGS := -O
CCFLAGS := -O
CXXFLAGS += -O2
FCFLAGS := -O2
CCFLAGS := -O2
else
ifdef G4DEBUG
CXXFLAGS += -g
@@ -25,12 +25,12 @@ ifeq ($(G4SYSTEM),Linux-icc)
FCFLAGS += -fPIC
CCFLAGS += -fPIC
endif
G4RUNPATHOPTION := -Xlinker -rpath
G4RUNPATHOPTION := -Wl,-rpath -Wl,
CC := gcc
FC := g77
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
FCLIBS := -lg2c -lnsl
AR := xiar r
AR := ar r
ECHO := /bin/echo -e
SHEXT := so
ifndef X11FLAGS
@@ -52,6 +52,7 @@ ifeq ($(G4SYSTEM),Linux-icc)
XAWLIBS := -lXaw
endif
DLDLIBS := -ldl
LOADLIBS += -lcxa -lunwind
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
+15 -10
View File
@@ -1,5 +1,5 @@
#
# ------ WIN32/VC ------ Visual-C++ 7 .NET
# ------ WIN32/VC ------ Visual-C++ 7 .NET and higher
#
ifeq ($(G4SYSTEM),WIN32-VC)
CXX := CL
@@ -17,7 +17,12 @@ ifeq ($(G4SYSTEM),WIN32-VC)
SHEXT := dll
AR := LIB
ECHO := echo -e
ECHO := /usr/bin/echo -e
GREP := /usr/bin/grep
SED := /usr/bin/sed
CAT := /usr/bin/cat
CUT := /usr/bin/cut
FC := g77
# FCLIBS := -lf2c
ifndef OGLFLAGS
@@ -57,20 +62,20 @@ ifeq ($(G4SYSTEM),WIN32-VC)
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`;\
cd $(G4TMP)/$(G4SYSTEM);\
echo "Building $(name).dumpbin file ...";\
$(ECHO) "Building $(name).dumpbin file ...";\
$(RM) $(name).dumpbin;\
dumpbin /symbols $(G4LIBDIR)/lib$(name).a > $(name).dumpbin;\
echo "Building $(name).def file ...";\
$(ECHO) "Building $(name).def file ...";\
$(RM) $(name).def;\
$(G4LIB)/$(G4SYSTEM)/win32def.exe $(name) < $(name).dumpbin > $(name).def;\
$(RM) $(name).dumpbin;\
echo "Building lib$(name).exp and lib$(name).lib file ...";\
$(ECHO) "Building lib$(name).exp and lib$(name).lib file ...";\
$(RM) $(G4LIBDIR)/lib$(name).exp;\
$(RM) $(G4LIBDIR)/lib$(name).lib;\
lib.exe /nologo /machine:ix86 /def:$(name).def \
/out:$(G4LIBDIR)/lib$(name).lib;\
$(RM) $(G4LIBDIR)/$(name).dll;\
echo "Building $(name).dll file ...";\
$(ECHO) "Building $(name).dll file ...";\
link.exe /nologo /dll /out:$(G4LIBDIR)/$(name).dll \
$(G4LIBDIR)/lib$(name).exp $(G4LIBDIR)/lib$(name).a \
/libpath:$(G4LIBDIR) $(GLOBLIBS) \
@@ -80,20 +85,20 @@ ifeq ($(G4SYSTEM),WIN32-VC)
define build-global-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`;\
cd $(G4TMP)/$(G4SYSTEM);\
echo "Building $(name).dumpbin file ...";\
$(ECHO) "Building $(name).dumpbin file ...";\
$(RM) $(name).dumpbin;\
dumpbin /symbols $(G4LIBDIR)/lib$(name).a > $(name).dumpbin;\
echo "Building $(name).def file ...";\
$(ECHO) "Building $(name).def file ...";\
$(RM) $(name).def;\
$(G4LIB)/$(G4SYSTEM)/win32def.exe $(name) < $(name).dumpbin > $(name).def;\
$(RM) $(name).dumpbin;\
echo "Building lib$(name).exp and lib$(name).lib ...";\
$(ECHO) "Building lib$(name).exp and lib$(name).lib ...";\
$(RM) $(G4LIBDIR)/lib$(name).exp;\
$(RM) $(G4LIBDIR)/lib$(name).lib;\
lib.exe /nologo /machine:ix86 /def:$(name).def \
/out:$(G4LIBDIR)/lib$(name).lib;\
$(RM) $(G4LIBDIR)/$(name).dll;\
echo "Building $(name).dll ...";\
$(ECHO) "Building $(name).dll ...";\
link.exe /nologo /dll /out:$(G4LIBDIR)/$(name).dll \
$(G4LIBDIR)/lib$(name).exp $(G4LIBDIR)/lib$(name).a \
/libpath:$(G4LIBDIR) $(GLOBLIBS) \
+10 -4
View File
@@ -1,7 +1,7 @@
#
# ------ GNU/WIN32 CYGNUS ------ !!! not supported !!!
# ------ GNU/WIN32 CYGWIN ------ !!! not supported !!!
# Cygnus CygWin - gcc-3.2 and higher
# Windows 2000/XP
# Windows XP
#
# Stefano Agostinelli (agos001@pn.itnet.it) - IST Group, Genova
#
@@ -25,12 +25,18 @@ ifeq ($(G4SYSTEM),WIN32-g++)
FCFLAGS += -fPIC
CCFLAGS += -fPIC
endif
G4RUNPATHOPTION := -Wl,-rpath
SHEXT := so
ECHO := echo -e
GREP := /usr/bin/grep
SED := /usr/bin/sed
CAT := /usr/bin/cat
CUT := /usr/bin/cut
FC := g77
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
FCLIBS := -lg2c -lnsl
ECHO := echo -e
SHEXT := so
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
+17 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.24 2006/06/29 06:15:06 kmura Exp $
$Id: History,v 1.27 2006/12/01 02:42:50 kmura Exp $
-------------------------------------------------------------------
=========================================================
@@ -18,6 +18,22 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
envs-V08-01-02 01 December 2006 Koichi Murakami
- pyG4Material.cc : fix namespace problem
- pyG4VisManager.cc : replace SetVerboisity with SetVerboseLevel for G4.8.2
- add messenger for ExN03geom
envs-V08-01-01 21 November 2006 Koichi Murakami
- implement G4ExceptionHandler as translation to Python exceptions
- remove obsolete method; G4VPhysicalVolume::GetObjectRotation()
envs-V08-01-00 20 November 2006 Koichi Murakami
[g4py]
- add MacOSX support
- more exposed staffs
- add physics list module
- add GUI examples using wxPython
envs-V08-00-09 29 June 2006 Koichi Murakami
[g4py]
- fix rpath of boost_python (config/sys/linux.gmk, linuxx8664gcc.gmk)
@@ -25,7 +25,7 @@
//
// Taken from
// $Id: MomoEventAction.hh,v 1.2 2006/06/29 15:27:31 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
#ifndef MomoEventAction_h
@@ -25,7 +25,7 @@
//
// Taken after
// $Id: MomoRunAction.hh,v 1.2 2006/06/29 15:27:45 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
#ifndef MomoRunAction_h
@@ -25,7 +25,7 @@
//
// Taken from
// $Id: MomoEventAction.cc,v 1.2 2006/06/29 15:27:54 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
@@ -25,7 +25,7 @@
//
// Taken from
// $Id: MomoRunAction.cc,v 1.2 2006/06/29 15:28:02 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
+12 -2
View File
@@ -1,4 +1,4 @@
$Id: 00README,v 1.4 2006/06/14 01:28:37 kmura Exp $
$Id: 00README,v 1.6 2006/08/10 08:48:26 kmura Exp $
==========================================================================
Geant4Py
@@ -33,6 +33,16 @@ BOOST-Python
(Optional)
ROOT
Before Starting:
----------------
In dafault situation, Geant4 creates and uses "granular static libraries".
But, the Python interface requires "global shared library".
If you donot build your Geant4 libraries in global shared mode,
you have to recreate your instance additionally.
In "tools" directory, you can find some ways to handle both "glanular static"
and "global shared" environments. Please take a look.
How to Install:
---------------
@@ -85,7 +95,7 @@ Enable/disable options: prefix with either --enable- or --disable-
Supported Architectures:
linux for Linux gcc 3.x and 4.x
linuxx8664gcc for AMD Opteron and Intel EM64T Linux gcc 3.x and 4.x
macosx for MacOS X with gcc (test)
macosx for MacOS X with gcc
You can specify all parameters adopting your environment.
+97
View File
@@ -0,0 +1,97 @@
<<<How to install Geant4Py in Mac OSX>>>
H. Yoshida and K. Murakami
16 November 2006 for Geant4-8.2 release
Geant4Py package can be installed in Linux or Mac OS X systems. Documentation
on the installation and the latest version is available at
www-geant4.kek.jp/projects/Geant4Py.
This text is a supplementary document dedicated to Mac OS X. The following
installation procedure was tested on a MacBook; Mac OS X 10.4.8 (8L2127), and
Darwin-8.8.1.
0) General remarks
You have to install ALL packages from the system DVD, including supplementary
packages and Xcode packages. Then, OpenGL must work.
a. Compilation of Geant4 libraries;
*.dylib must be created and all header files must be assembled. So
%make global; make includes
b. Linker;
If ld (linker) complains "Undefined symbols", try
%setenv MACOSX_DEPLOYMENT_TARGET 10.4
c. Path of the Dynamic Libraries ;
If you have used Configure script to make the Geant4 libraries, the paths
to the dylibs are set automatically. The environment variables can be
checked in $G4INSTALL/.config/bin/Darwin-g++/env.csh.
d. X window;
For visialization with OpenGL, you have to start Xserver and
%setenv DISPLAY localhost:0.0
1) Installation of Python 2.4.3
The latest Mac products (as of October 2006) include Python 2.3 by
default. This is not bad for the basic installation of Geant4Py, but some
examples here require Python 2.4 which provides advanced OS related
functionalities. So, we recommend you to install Python 2.4.3. (Python 2.5 is
already published but we don't tested it with respect to boost_python
wrappers.)
Visit the Python language Web site; http://www.python.org/download/mac/ and
follow the instructions. Universal-MacPython-2.4.3-*.dmg is available
there. Or the site http://pythonmac.org/packages/ provides also *.dmg package,
too.
2) Installation of Boost-Python
Visit the site http://boost.org/ and download boost-1_33_1, the latest
version. Then, run the configure script and then make libboost_python.dylib.
Please make install it to the default prefix directory, i.e., /usr/local, for
simplcity.
3) Compilation of Geant4Py
If you have installed Python-2.4 and Boost-1_33_1 as above, you can configure
Geant4Py as below;
./configure macosx --with-python-incdir=/usr/local/include/python2.4\
--with-python-libdir=/usr/local/lib/python2.4\
--with-boost-incdir=/usr/local/include/boost-1_33_1\
--with-boost-libdir=/usr/local/lib\
--with-boost-python-lib=boost_python-1_33_1
And then, %make; make install. The libraries will be installed in
$G4INSTALL/environments/g4py/lib whose path must be added to PYTHONPATH.
If you want to enjoy examples/education, wxPython package is necessary.
4) Installation of wxPython
Download the latest version of wxPython from http://www.wxpython.org/ and
create the library. The next instructions are taken from the above Web page.
%cd $WXDIR
%mkdir bld
%cd bld
%../configure --prefix=/opt/wx/2.7 \
--with-mac\
--with-opengl \
--enable-debug \
--enable-geometry \
--enable-graphics_ctx \
--enable-sound --with-sdl \
--enable-mediactrl \
--enable-display \
--disable-debugreport
And then make; make install.
You have to setenv/export PYTHONPATH, adding /opt/wx/2.7
5) Run
g4py/examples/education/lesson1/Lesson1Wx.py and lesson2/Lesson2Wx.py are
exaples, using wxPython GUI toolkits. Run them,
%python Lesson1Wx.py
+1 -1
View File
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.1 2006/02/27 09:29:42 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py
# ===========================================================
+37 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.14 2006/06/29 02:04:49 kmura Exp $
$Id: History,v 1.23 2006/12/01 02:38:18 kmura Exp $
-------------------------------------------------------------------
=========================================================
@@ -14,6 +14,42 @@ Geant4Py is a Geant4-Python bridge.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
01 Dec 2006 K.Murakami (1.2.0)
- pyG4Material.cc : fix namespace problem
- pyG4VisManager.cc : replace SetVerboisity with SetVerboseLevel for G4.8.2
- add messenger for ExN03geom
21 November 2006 K.Murakami (1.1.0)
- implement G4ExceptionHandler as translation to Python exceptions
- remove obsolete method; G4VPhysicalVolume::GetObjectRotation()
20 November 2006 K.Murakami
- modification for G4.8.2
- add G4Exception and G4ExceptionSeverity
- modify configure for supporting physics lists
- add physics list modules
15 November 2006 H. Yoshida
- add 00README_MACOSX
23 August 2006 K.Murakami
- add G4Version
- G4LossTableManager, modify for version evolution
06 August 2006 K.Murakami (1.0.2)
- modify config tools for building on MacOSX (some side-effects)
- add tools dir for support tools for building user environment
- add intercoms dir (move pyG4UImanager.cc from interfacr to intercoms)
- new exposed staffs;
G4UImanager, G4UIcommandTree, G4UIcommand, G4UIparameter
- __init__.py is updeted
(gUImanager as global, and some modifications)
12 July 2006 K.Murakami (1.0.1)
- add exposures of G4LossTableManager, G4ProductionCutsTable
- add site-modules/utls/MCScore
- add site-modules/physics_lists/EMLowEpl
29 June 2006 K.Murakami
- "site-modules/primaries/MedicalBeam/MedicalMeam.cc"
fix a bug in calculation of cos from a sin value
+14 -2
View File
@@ -1,4 +1,4 @@
# $Id: build.gmk,v 1.2 2006/04/25 05:53:05 kmura Exp $
# $Id: build.gmk,v 1.3 2006/08/08 05:11:44 kmura Exp $
# ===========================================================
# Script for building a module
# ===========================================================
@@ -8,9 +8,21 @@ objects := $(patsubst %.cc, %.o, $(sources))
.PHONY: clean debug
module_name := $(MODULE).$(soext)
# 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)
+2 -2
View File
@@ -1,4 +1,4 @@
# $Id: g4compile.gmk,v 1.1 2006/04/25 05:53:05 kmura Exp $
# $Id: g4compile.gmk,v 1.2 2006/08/08 05:11:44 kmura Exp $
# ===========================================================
# Script for building a Boost-Python module
# ===========================================================
@@ -37,7 +37,7 @@ objects := $(patsubst %.cc, %.o, $(sources))
.PHONY: clean debug
all : $(objects)
compile : $(objects)
clean :
@-rm -f $(objects)
+5 -1
View File
@@ -1,4 +1,4 @@
# $Id: g4py.gmk,v 1.2 2006/04/25 05:53:05 kmura Exp $
# $Id: g4py.gmk,v 1.3 2006/11/20 08:01:30 kmura Exp $
# ===========================================================
# Makefile for building Python module with Boost.Python
#
@@ -23,6 +23,10 @@ G4PY_LOPT := -L$(Q_G4_LIBDIR) \
-lG4interfaces \
-lG4global
ifeq ($(Q_ENABLE_PHYSICSLIST), 1)
G4PY_LOPT += -lG4physicslists
endif
include $(G4PY_INSTALL)/config/g4vis.gmk
G4PY_LOPT += $(G4PY_VISLIBS)
+10 -7
View File
@@ -1,5 +1,5 @@
# $Id: linux.gmk,v 1.3 2006/06/27 06:40:13 kmura Exp $
# $Name: geant4-08-01 $
# $Id: linux.gmk,v 1.5 2006/08/10 08:49:08 kmura Exp $
# $Name: geant4-08-02 $
# ===========================================================
# System specific terms
# ===========================================================
@@ -10,6 +10,7 @@ CXX := g++ -m32
ifdef COMPILE_WITH_BOOST
CXXFLAGS := -fPIC -ftemplate-depth-255 -finline-functions -Wno-inline
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
@@ -17,12 +18,14 @@ 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 += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
@@ -30,6 +33,7 @@ endif
# extention of shared library
soext := so
modext := so
# implicit rules
%.o: %.cc
@@ -61,20 +65,19 @@ ifdef COMPILE_G4PY
ifneq ($(Q_CLHEP_LIBDIR), $(Q_G4_LIBDIR))
rpath3 := :$(Q_CLHEP_LIBDIR)
endif
rpath4 := $(Q_LIBDIR)
endif
rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3)
rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3):$(rpath4)
ifdef CPPVERBOSE
define build-library
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ \
$(foreach dir,$(SUBLIBS),$(dir)/*.o)
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects)
endef
else
define build-library
@echo Building a library $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ \
$(foreach dir,$(SUBLIBS),$(dir)/*.o)
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects)
endef
endif
+10 -7
View File
@@ -1,5 +1,5 @@
# $Id: linuxx8664gcc.gmk,v 1.3 2006/06/27 06:40:14 kmura Exp $
# $Name: geant4-08-01 $
# $Id: linuxx8664gcc.gmk,v 1.5 2006/08/10 08:49:08 kmura Exp $
# $Name: geant4-08-02 $
# ===========================================================
# System specific terms
# ===========================================================
@@ -10,6 +10,7 @@ CXX := g++ -m64
ifdef COMPILE_WITH_BOOST
CXXFLAGS := -fPIC -ftemplate-depth-255 -finline-functions -Wno-inline
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
@@ -17,12 +18,14 @@ 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 += -DBOOST_PYTHON_DYNAMIC_LIB
CXXFLAGS += -O2
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
@@ -30,6 +33,7 @@ endif
# extention of shared library
soext := so
modext := so
# implicit rules
%.o: %.cc
@@ -61,20 +65,19 @@ ifdef COMPILE_G4PY
ifneq ($(Q_CLHEP_LIBDIR), $(Q_G4_LIBDIR))
rpath3 := :$(Q_CLHEP_LIBDIR)
endif
rpath4 := $(Q_LIBDIR)
endif
rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3)
rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3):$(rpath4)
ifdef CPPVERBOSE
define build-library
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ \
$(foreach dir,$(SUBLIBS),$(dir)/*.o)
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects)
endef
else
define build-library
@echo Building a library $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ \
$(foreach dir,$(SUBLIBS),$(dir)/*.o)
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects)
endef
endif
+25 -26
View File
@@ -1,37 +1,43 @@
# $Id: macosx.gmk,v 1.2 2006/04/25 05:50:05 kmura Exp $
# $Name: geant4-08-01 $
# $Id: macosx.gmk,v 1.4 2006/08/10 08:49:08 kmura Exp $
# $Name: geant4-08-02 $
# ===========================================================
# System specific terms
#
# MacOSX 10.4 (Tiger) gcc 4.0.1
# Note: gc-3.3 is not valid for this setup.
# ===========================================================
# compile flags
CXX := g++
ifdef COMPILE_WITH_BOOST
CXXFLAGS := -fPIC -ftemplate-depth-256 -Wno-long-double
CXXFLAGS += -no-cpp-precomp -fno-inline -fcoalesce-templates
CXXFLAGS := -ftemplate-depth-256 -Wno-long-double
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 += -fPIC
CXXFLAGS += -O2
endif
ifdef COMPILE_G4PY
CXXFLAGS := -fPIC -ansi -pipe
CXXFLAGS := -ansi -pipe
CXXFLAGS += -ftemplate-depth-256 -Wno-long-double
CXXFLAGS += -no-cpp-precomp -fno-inline -fcoalesce-templates
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 := so
soext := dylib
modext := so
# implicit rules
%.o: %.cc
@@ -47,43 +53,36 @@ endif
# building a shared library
ifdef BOOST_LIBDIR
rpath0 := $(BOOST_LIBDIR)
ifdef LOCALLIB
install_path := $(PWD)
else
install_path := $(Q_LIBDIR)
endif
ifdef G4PY_EXLIB_LIBDIR
rpath1 := $(G4PY_EXLIB_LIBDIR)
endif
ifdef COMPILE_G4PY
rpath2 := $(Q_G4_LIBDIR):$(Q_CLHEP_LIBDIR)
endif
#rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2)
rpathflag :=
ifdef CPPVERBOSE
define build-library
$(CXX) $(rpathflag) -bundle -flat_namespace -undefined define_a_way \
-o $@ $(foreach dir,$(SUBLIBS),$(dir)/*.o)
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
-o $@ -install_name $(install_path)/$@ $(objects)
endef
else
define build-library
@echo Building a module $@ ...
@$(CXX) $(rpathflag) -bundle -flat_namespace -undefined define_a_way \
-o $@ $(foreach dir,$(SUBLIBS),$(dir)/*.o)
@$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
-o $@ -install_name $(install_path)/$@ $(objects)
endef
endif
# building a module
ifdef CPPVERBOSE
define build-module
$(CXX) $(rpathflag) -bundle -flat_namespace -undefined define_a_way \
$(CXX) -Wl,-x -bundle -flat_namespace -dead_strip \
-o $@ $(objects) $(LOPT)
endef
else
define build-module
@echo Building a module $@ ...
@$(CXX) $(rpathflag) -bundle -flat_namespace -undefined define_a_way \
@$(CXX) -Wl,-x -bundle -flat_namespace -dead_strip \
-o $@ $(objects) $(LOPT)
endef
endif
+33 -11
View File
@@ -1,5 +1,5 @@
#! /bin/sh -
#$Id: configure,v 1.3 2006/06/20 09:35:06 kmura Exp $
#$Id: configure,v 1.5 2006/11/20 08:01:17 kmura Exp $
# ======================================================================
# A configure script for Geant4Py
# ======================================================================
@@ -58,7 +58,7 @@ Enable/disable options: prefix with either --enable- or --disable-
Supported Architectures:
linux for Linux gcc 3.x and 4.x
linuxx8664gcc for AMD Opteron and Intel EM64T Linux gcc 3.x and 4.x
macosx for MacOS X with gcc (test)
macosx for MacOSX with gcc (Tiger and XCode 2.3)
EOF
}
@@ -92,6 +92,7 @@ enable_openglxm=${enable_openglxm:-0}
enable_raytracerx=${G4VIS_USE_RAYTRACERX:+1}
enable_raytracerx=${enable_raytracerx:-0}
enable_physicslist=0
# checking system
case $1 in
@@ -174,6 +175,11 @@ if [ $system == linuxx8664gcc ]; then
arch=64
fi
shlib=so
if [ $system == macosx ]; then
shlib=dylib
fi
echo -n "Checking for prefix ... "
echo $prefix
@@ -243,13 +249,13 @@ fi
echo "$clhep_libdir"
echo -n "Checking for CLHEP lib name ... "
if [ ! -f "$clhep_libdir"/lib${clhep_lib}.so ]; then
if [ ! -f "$clhep_libdir"/lib${clhep_lib}.${shlib} ]; then
echo "no"
echo -n "### lib${clhep_lib}.so (clhep-lib) does not exist. "
echo -n "### lib${clhep_lib}.${shlib} (clhep-lib) does not exist. "
echo "Try --with-clhep-lib option."
exit -1
fi
echo "lib${clhep_lib}.so"
echo "lib${clhep_lib}.${shlib}"
# ---
echo -n "Checking for Python include dir (pyconfig.h) ... "
@@ -304,17 +310,17 @@ fi
echo "$boost_libdir"
echo -n "Checking for Boost Python lib name ... "
if [ ! -f "$boost_libdir"/lib${boost_python_lib}.so ]; then
if [ ! -f "$boost_libdir"/lib${boost_python_lib}.${shlib} ]; then
echo "no"
echo -n "### lib${boost_python_lib}.so (boost-python-lib) does not exist. "
echo -n "### lib${boost_python_lib}.${shlib} (boost-python-lib) does not exist. "
echo "Try --with-boost-libdir option."
exit -1
fi
echo "lib${boost_python_lib}.so"
echo "lib${boost_python_lib}.${shlib}"
# ---
echo -n "Checking for OpenGL support ..."
if [ -f "$g4_libdir"/libG4OpenGL.so ]; then
if [ -f "$g4_libdir"/libG4OpenGL.${shlib} ]; then
if [ $enable_openglx == 0 ]; then
echo "disabled"
else
@@ -325,6 +331,18 @@ else
enable_openglx=0
fi
# ---
echo -n "Checking for physics list support ..."
if [ -f "$g4_incdir"/QGSP.hh ]; then
enable_physicslist=1
fi
if [ $enable_physicslist == 0 ]; then
echo "no"
else
echo "yes"
fi
# ---
echo -n "Writing config.gmk ... "
@@ -371,6 +389,8 @@ Q_ENABLE_OPENGLX := $enable_openglx
Q_ENABLE_OPENGLXM := $enable_openglxm
Q_ENABLE_RAYTRACERX := $enable_raytracerx
Q_ENABLE_PHYSICSLIST := $enable_physicslist
EOF
echo "done"
echo -n "Writing config.status ... "
@@ -392,6 +412,10 @@ if [ $enable_raytracerx = 1 ]; then
echo -n " raytracerx"
fi
if [ $enable_physicslist = 1 ]; then
echo -n " physicslist"
fi
echo "."
# ---
@@ -404,5 +428,3 @@ echo ""
exit 0
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.1 2006/05/11 04:35:32 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: MyDetectorConstruction.cc,v 1.3 2006/06/29 15:28:11 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// MyDetectorConstruction.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: MyDetectorConstruction.hh,v 1.3 2006/06/29 15:28:13 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// MyDetectorConstruction.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: MyMaterials.cc,v 1.3 2006/06/29 15:28:16 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// MyMaterials.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: MyMaterials.hh,v 1.3 2006/06/29 15:28:19 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// MyMaterials.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: MyPhysicsList.cc,v 1.3 2006/06/29 15:28:21 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// MyPhysicsList.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: MyPhysicsList.hh,v 1.3 2006/06/29 15:28:23 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// MyPhysicsList.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: Particles.cc,v 1.3 2006/06/29 15:28:25 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// Particles.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PhysicsListEMstd.cc,v 1.3 2006/06/29 15:28:29 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// PhysicsListEMstd.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pydemo_wp.cc,v 1.3 2006/06/29 15:28:40 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pydemo_wp.cc
//
@@ -1,3 +1,8 @@
27 Sep. 2006 Hajime Yoshida
- Lesson1.py as before
- Lesson1withN03.py with the physics list of N03
- Lesson2Wx.py N03 physics list AND wxPython GUI
09 March 2006
Hajime Yoshida
@@ -0,0 +1,555 @@
from Geant4 import *
import NISTmaterials
from EZsim import EZgeom
from EZsim.EZgeom import G4EzVolume
import ExN03pl
import ParticleGun
from time import *
import sys
from subprocess import *
import os
# ==================================================================
# intialize
# ==================================================================
def Configure():
# ------------------------------------------------------------------
# setup for materials
# ------------------------------------------------------------------
# simple materials for Qgeom
NISTmaterials.Construct()
# ------------------------------------------------------------------
# setup for geometry
# ------------------------------------------------------------------
EZgeom.Construct() # initialize
# ------------------------------------------------------------------
# setup for physics list of N03
# ------------------------------------------------------------------
ExN03pl.Construct()
# ------------------------------------------------------------------
# setup for primary generator action
# ------------------------------------------------------------------
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
}
EZgeom.SetWorldMaterial(galactic)
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 = 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()
@@ -0,0 +1,319 @@
#!/usr/bin/python
# ==================================================================
# python script for "measurement" of mass attenuation coefficient
#
#
# - using site-module packages
# ==================================================================
from Geant4 import *
import NISTmaterials
from EZsim import EZgeom
from EZsim.EZgeom import G4EzVolume
import ExN03pl
import ParticleGun
from time import *
import sys
# ==================================================================
# intialize
# ==================================================================
def Configure():
# ------------------------------------------------------------------
# setup for materials
# ------------------------------------------------------------------
# simple materials for Qgeom
NISTmaterials.Construct()
# ------------------------------------------------------------------
# setup for geometry
# ------------------------------------------------------------------
#Qgeom.Construct()
EZgeom.Construct() # initialize
# ------------------------------------------------------------------
# setup for physics list
# ------------------------------------------------------------------
ExN03pl.Construct()
# ------------------------------------------------------------------
# setup for primary generator action
# ------------------------------------------------------------------
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}
EZgeom.SetWorldMaterial(galactic)
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 = 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,7 +1,21 @@
09 March 2006
Hajime Yoshida
******* README of lesson1 ******
26 September 2006
- Lesson1.py as before
- Lesson1withN03.py
- physics is list is taken from examples/novice/N03
- process on/off
- Leson1Wx.py
- same as Lesson1withN03 but
- New GUI toolkit is used and the default Python isn't enough
- wxPython is necessary
26 May 2006 Geant4.8.1
Hajime Yoshida
The first version of the courseware of the mass attenuation coefficient
@@ -0,0 +1,598 @@
#### 2006 Sep 26, the first draft version
## Wired not yet. g4pipe control and Popen
from Geant4 import *
import Qmaterials, NISTmaterials
import ExN03geom
import ExN03pl
import ParticleGun, 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
#NISTmaterials.Construct()
# ------------------------------------------------------------------
# setup for geometry
# ------------------------------------------------------------------
# normal way for constructing user geometry
exN03geom= ExN03geom.ExN03DetectorConstruction()
gRunManager.SetUserInitialization(exN03geom)
# 2nd way, short-cut way
#ExN01geom.Construct()
#ExN03geom.Construct()
# magnetic field
#exN03geom.SetMagField(0.1 * tesla)
# ------------------------------------------------------------------
# setup for physics list
# ------------------------------------------------------------------
# normal way for constructing user physics list
exN03PL= ExN03pl.ExN03PhysicsList()
gRunManager.SetUserInitialization(exN03PL)
# 2nd way, short-cut way
#ExN01pl.Construct()
# ------------------------------------------------------------------
# setup for primary generator action
# ------------------------------------------------------------------
# normal way for constructing user physics list
#pgPGA= ParticleGun.ParticleGunAction()
#gRunManager.SetUserAction(pgPGA)
#pg= pgPGA.GetParticleGun()
# 2nd way, short-cut way
pg= 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,3 +1,8 @@
26 Sep 2006
- added Lesson2Wx.py
New version using wxPython
functionas are identical with ExN03.py
26 May 2006
revised 02 July 2006
Geant4.8.1 release
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: EzDetectorConstruction.cc,v 1.3 2006/06/29 15:28:43 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// EzDetectorConstruction.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: EzDetectorConstruction.hh,v 1.3 2006/06/29 15:28:46 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// EzDetectorConstruction.hh
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 08:58:18 kmura Exp $
# $Name: geant4-08-01 $
# $Id: GNUmakefile,v 1.3 2006/08/10 08:50:18 kmura Exp $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -32,9 +32,6 @@ cleanall:
PACKAGE := EZsim#
MODULE := EZgeom#
# location of exposured library
G4PY_EXLIB_LIBDIR := $(Q_LIBDIR)
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EzVolume.cc,v 1.3 2006/06/29 15:28:52 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// G4EzVolume.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EzVolume.hh,v 1.3 2006/06/29 15:28:55 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// G4EzVolume.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EzVoxelParameterization.cc,v 1.3 2006/06/29 15:28:58 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// G4EzVoxelParameterization.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EzVoxelParameterization.hh,v 1.3 2006/06/29 15:29:01 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// G4EzVoxelParameterization.hh
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EzWorld.cc,v 1.3 2006/06/29 15:29:04 gunter Exp $
// $Name: geant4-08-01 $
// $Id: G4EzWorld.cc,v 1.4 2006/08/25 05:13:16 kmura Exp $
// $Name: geant4-08-02 $
// ====================================================================
// G4EzWorld.cc
//
@@ -38,7 +38,7 @@
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4RunManager.hh"
#include "G4Version.hh"
#include "pyG4Version.hh"
G4VPhysicalVolume* G4EzWorld::world= G4EzWorld::CreateWorld();
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4EzWorld.hh,v 1.3 2006/06/29 15:29:07 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// G4EzWorld.hh
//
@@ -1,11 +1,11 @@
# $Id: GNUmakefile,v 1.1 2006/04/25 09:00:01 kmura Exp $
# $Name: geant4-08-01 $
# $Id: GNUmakefile,v 1.2 2006/08/08 05:26:19 kmura Exp $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
include ../../../../config/config.gmk
MODULE := libezgeom#
LIBRARY := libezgeom#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
@@ -13,5 +13,5 @@ include $(G4PY_INSTALL)/config/module.gmk
install:
@echo ... intall $(lib_name) into $(Q_LIBDIR)
@if [ ! -d $(Q_LIBDIR) ]; then install -d $(Q_LIBDIR); fi
@install -m 755 $(MODULE).$(soext) $(Q_LIBDIR)
@install -m 755 $(LIBRARY).$(soext) $(Q_LIBDIR)
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyEzgeom.cc,v 1.3 2006/06/29 15:28:49 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyEZgeom.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:17:30 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.3 2006/06/14 08:23:52 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
+3 -3
View File
@@ -1,11 +1,11 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:18:58 kmura Exp $
# $Name: geant4-08-01 $
# $Id: GNUmakefile,v 1.3 2006/07/12 01:56:23 kmura Exp $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
include ../config/config.gmk
SUBDIR := geometries materials physics_lists primaries
SUBDIR := geometries materials physics_lists primaries utils
SUBDIR += EZsim
.PHONY: all install clean uninstall
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ExN01DetectorConstruction.cc,v 1.4 2006/06/29 15:29:10 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// ExN01DetectorConstruction.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ExN01DetectorConstruction.hh,v 1.4 2006/06/29 15:29:12 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// ExN01DetectorConstruction.hh
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:25:12 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyExN01geom.cc,v 1.4 2006/06/29 15:29:14 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyExN01geom.cc
//
@@ -23,14 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExN03DetectorConstruction.cc,v 1.4 2006/06/29 15:29:16 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// ExN03DetectorConstruction.cc
//
// 2005 Q
// ====================================================================
// $Id: ExN03DetectorConstruction.cc,v 1.5 2006/12/01 02:37:01 kmura Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN03DetectorConstruction.hh"
#include "ExN03DetectorMessenger.hh"
#include "G4Material.hh"
#include "G4Box.hh"
@@ -47,14 +50,8 @@
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////////////////////////////
ExN03DetectorConstruction::ExN03DetectorConstruction()
:AbsorberMaterial(0),GapMaterial(0),defaultMaterial(0),
solidWorld(0),logicWorld(0),physiWorld(0),
@@ -63,7 +60,6 @@ ExN03DetectorConstruction::ExN03DetectorConstruction()
solidAbsorber(0),logicAbsorber(0),physiAbsorber(0),
solidGap (0),logicGap (0),physiGap (0),
magField(0)
//////////////////////////////////////////////////////
{
// default parameter values of the calorimeter
AbsorberThickness = 10.*mm;
@@ -77,27 +73,25 @@ ExN03DetectorConstruction::ExN03DetectorConstruction()
SetAbsorberMaterial("Lead");
SetGapMaterial("liquidArgon");
// create commands for interactive definition of the calorimeter
detectorMessenger = new ExN03DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
///////////////////////////////////////////////////////
ExN03DetectorConstruction::~ExN03DetectorConstruction()
///////////////////////////////////////////////////////
{
}
{ delete detectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/////////////////////////////////////////////////////////
G4VPhysicalVolume* ExN03DetectorConstruction::Construct()
/////////////////////////////////////////////////////////
{
return ConstructCalorimeter();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/////////////////////////////////////////////////
void ExN03DetectorConstruction::DefineMaterials()
/////////////////////////////////////////////////
{
//This function illustrates the possible ways to define materials
@@ -112,6 +106,7 @@ void ExN03DetectorConstruction::DefineMaterials()
//
// define Elements
//
G4Element* H = new G4Element("Hydrogen",symbol="H" , z= 1., a= 1.01*g/mole);
G4Element* C = new G4Element("Carbon" ,symbol="C" , z= 6., a= 12.01*g/mole);
G4Element* N = new G4Element("Nitrogen",symbol="N" , z= 7., a= 14.01*g/mole);
@@ -121,6 +116,7 @@ void ExN03DetectorConstruction::DefineMaterials()
//
// define an Element from isotopes, by relative abundance
//
G4Isotope* U5 = new G4Isotope("U235", iz=92, n=235, a=235.01*g/mole);
G4Isotope* U8 = new G4Isotope("U238", iz=92, n=238, a=238.03*g/mole);
@@ -131,6 +127,7 @@ void ExN03DetectorConstruction::DefineMaterials()
//
// define simple materials
//
new G4Material("Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3);
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
new G4Material("Lead" , z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
@@ -138,6 +135,7 @@ void ExN03DetectorConstruction::DefineMaterials()
//
// define a material from elements. case 1: chemical molecule
//
G4Material* H2O =
new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
H2O->AddElement(H, natoms=2);
@@ -171,8 +169,7 @@ void ExN03DetectorConstruction::DefineMaterials()
Air->AddElement(O, fractionmass=0.3);
//
// define a material from elements and/or others materials
// (mixture of mixtures)
// define a material from elements and/or others materials (mixture of mixtures)
//
G4Material* Aerog =
@@ -199,10 +196,10 @@ void ExN03DetectorConstruction::DefineMaterials()
//
// examples of vacuum
//
G4Material* Vacuum =
new G4Material("Galactic", z=1., a=1.01*g/mole,
density= universe_mean_density,
kStateGas, 3.e-18*pascal, 2.73*kelvin);
new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
kStateGas, 2.73*kelvin, 3.e-18*pascal);
G4Material* beam =
new G4Material("Beam", density= 1.e-5*g/cm3, ncomponents=1,
@@ -213,13 +210,13 @@ void ExN03DetectorConstruction::DefineMaterials()
//default materials of the World
defaultMaterial = Vacuum;
}
////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExN03DetectorConstruction::ConstructCalorimeter()
////////////////////////////////////////////////////////////////////
{
// Clean old geometry, if any
//
G4GeometryManager::GetInstance()->OpenGeometry();
@@ -233,8 +230,7 @@ G4VPhysicalVolume* ExN03DetectorConstruction::ConstructCalorimeter()
//
// World
//
solidWorld =
new G4Box("World", //its name
solidWorld = new G4Box("World", //its name
WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //its size
logicWorld = new G4LogicalVolume(solidWorld, //its solid
@@ -353,16 +349,37 @@ logicWorld = new G4LogicalVolume(solidWorld, //its solid
simpleBoxVisAtt->SetVisibility(true);
logicCalor->SetVisAttributes(simpleBoxVisAtt);
/*
// Below are vis attributes that permits someone to test / play
// with the interactive expansion / contraction geometry system of the
// vis/OpenInventor driver :
{G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0));
simpleBoxVisAtt->SetVisibility(true);
delete logicCalor->GetVisAttributes();
logicCalor->SetVisAttributes(simpleBoxVisAtt);}
{G4VisAttributes* atb= new G4VisAttributes(G4Colour(1.0,0.0,0.0));
logicLayer->SetVisAttributes(atb);}
{G4VisAttributes* atb= new G4VisAttributes(G4Colour(0.0,1.0,0.0));
atb->SetForceSolid(true);
logicAbsorber->SetVisAttributes(atb);}
{//Set opacity = 0.2 then transparency = 1 - 0.2 = 0.8
G4VisAttributes* atb= new G4VisAttributes(G4Colour(0.0,0.0,1.0,0.2));
atb->SetForceSolid(true);
logicGap->SetVisAttributes(atb);}
*/
//
//always return the physical World
//
return physiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//////////////////////////////////////////////////////
void ExN03DetectorConstruction::PrintCalorParameters()
//////////////////////////////////////////////////////
{
G4cout << "\n------------------------------------------------------------"
<< "\n---> The calorimeter is " << NbOfLayers << " layers of: [ "
@@ -372,64 +389,61 @@ void ExN03DetectorConstruction::PrintCalorParameters()
<< "\n------------------------------------------------------------\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
////////////////////////////////////////////////////////////////////////////
void ExN03DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
////////////////////////////////////////////////////////////////////////////
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial) AbsorberMaterial = pttoMaterial;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
///////////////////////////////////////////////////////////////////////
void ExN03DetectorConstruction::SetGapMaterial(G4String materialChoice)
///////////////////////////////////////////////////////////////////////
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial) GapMaterial = pttoMaterial;
}
//////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN03DetectorConstruction::SetAbsorberThickness(G4double val)
//////////////////////////////////////////////////////////////////
{
// change Absorber thickness and recompute the calorimeter parameters
AbsorberThickness = val;
}
/////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN03DetectorConstruction::SetGapThickness(G4double val)
/////////////////////////////////////////////////////////////
{
// change Gap thickness and recompute the calorimeter parameters
GapThickness = val;
}
////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN03DetectorConstruction::SetCalorSizeYZ(G4double val)
////////////////////////////////////////////////////////////
{
// change the transverse size and recompute the calorimeter parameters
CalorSizeYZ = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
////////////////////////////////////////////////////////
void ExN03DetectorConstruction::SetNbOfLayers(G4int val)
////////////////////////////////////////////////////////
{
NbOfLayers = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
////////////////////////////////////////////////////////////////
void ExN03DetectorConstruction::SetMagField(G4double fieldValue)
////////////////////////////////////////////////////////////////
{
//apply a global uniform magnetic field along Z axis
G4FieldManager* fieldMgr
@@ -447,12 +461,13 @@ void ExN03DetectorConstruction::SetMagField(G4double fieldValue)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
////////////////////////////////////////////////
void ExN03DetectorConstruction::UpdateGeometry()
////////////////////////////////////////////////
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,32 +23,78 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ExN03DetectorConstruction.hh,v 1.4 2006/06/29 15:29:18 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// ExN03DetectorConstruction.hh
//
// 2005 Q
// ====================================================================
#ifndef EXN03_DETECTOR_CONSTRUCTION_H
#define EXN03_DETECTOR_CONSTRUCTION_H
// $Id: ExN03DetectorConstruction.hh,v 1.5 2006/12/01 02:37:01 kmura Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN03DetectorConstruction_h
#define ExN03DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4UniformMagField;
class ExN03DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN03DetectorConstruction : public G4VUserDetectorConstruction
{
public:
ExN03DetectorConstruction();
~ExN03DetectorConstruction();
public:
void SetAbsorberMaterial (G4String);
void SetAbsorberThickness(G4double);
void SetGapMaterial (G4String);
void SetGapThickness(G4double);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers (G4int);
void SetMagField(G4double);
G4VPhysicalVolume* Construct();
void UpdateGeometry();
public:
void PrintCalorParameters();
G4double GetWorldSizeX() {return WorldSizeX;};
G4double GetWorldSizeYZ() {return WorldSizeYZ;};
G4double GetCalorThickness() {return CalorThickness;};
G4double GetCalorSizeYZ() {return CalorSizeYZ;};
G4int GetNbOfLayers() {return NbOfLayers;};
G4Material* GetAbsorberMaterial() {return AbsorberMaterial;};
G4double GetAbsorberThickness() {return AbsorberThickness;};
G4Material* GetGapMaterial() {return GapMaterial;};
G4double GetGapThickness() {return GapThickness;};
const G4VPhysicalVolume* GetphysiWorld() {return physiWorld;};
const G4VPhysicalVolume* GetAbsorber() {return physiAbsorber;};
const G4VPhysicalVolume* GetGap() {return physiGap;};
class ExN03DetectorConstruction : public G4VUserDetectorConstruction {
private:
G4Material* AbsorberMaterial;
G4double AbsorberThickness;
@@ -87,50 +133,16 @@ private:
G4UniformMagField* magField; //pointer to the magnetic field
ExN03DetectorMessenger* detectorMessenger; //pointer to the Messenger
private:
void DefineMaterials();
void ComputeCalorParameters();
G4VPhysicalVolume* ConstructCalorimeter();
public:
ExN03DetectorConstruction();
~ExN03DetectorConstruction();
// set/get mehtods...
void SetAbsorberMaterial (G4String);
void SetAbsorberThickness(G4double);
void SetGapMaterial (G4String);
void SetGapThickness(G4double);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers (G4int);
void SetMagField(G4double);
G4double GetWorldSizeX() { return WorldSizeX; }
G4double GetWorldSizeYZ() { return WorldSizeYZ; }
G4double GetCalorThickness() { return CalorThickness; }
G4double GetCalorSizeYZ() { return CalorSizeYZ; }
G4int GetNbOfLayers() { return NbOfLayers; }
G4Material* GetAbsorberMaterial() { return AbsorberMaterial; }
G4double GetAbsorberThickness() { return AbsorberThickness; }
G4Material* GetGapMaterial() { return GapMaterial; }
G4double GetGapThickness() { return GapThickness; }
const G4VPhysicalVolume* GetphysiWorld() { return physiWorld; }
const G4VPhysicalVolume* GetAbsorber() { return physiAbsorber; }
const G4VPhysicalVolume* GetGap() { return physiGap; }
// operations...
virtual G4VPhysicalVolume* Construct();
void UpdateGeometry();
void PrintCalorParameters();
};
// ====================================================================
// inline functions
// ====================================================================
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void ExN03DetectorConstruction::ComputeCalorParameters()
{
@@ -141,6 +153,7 @@ inline void ExN03DetectorConstruction::ComputeCalorParameters()
WorldSizeX = 1.2*CalorThickness; WorldSizeYZ = 1.2*CalorSizeYZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,150 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: ExN03DetectorMessenger.cc,v 1.1 2006/12/01 02:37:01 kmura Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN03DetectorMessenger.hh"
#include "ExN03DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN03DetectorMessenger::ExN03DetectorMessenger(
ExN03DetectorConstruction* ExN03Det)
:ExN03Detector(ExN03Det)
{
N03Dir = new G4UIdirectory("/N03/");
N03Dir->SetGuidance("UI commands of this example");
detDir = new G4UIdirectory("/N03/det/");
detDir->SetGuidance("detector control");
AbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
AbsMaterCmd->SetParameterName("choice",false);
AbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
GapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
GapMaterCmd->SetGuidance("Select Material of the Gap.");
GapMaterCmd->SetParameterName("choice",false);
GapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
AbsThickCmd->SetParameterName("Size",false);
AbsThickCmd->SetRange("Size>=0.");
AbsThickCmd->SetUnitCategory("Length");
AbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
GapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
GapThickCmd->SetGuidance("Set Thickness of the Gap");
GapThickCmd->SetParameterName("Size",false);
GapThickCmd->SetRange("Size>=0.");
GapThickCmd->SetUnitCategory("Length");
GapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
SizeYZCmd->SetParameterName("Size",false);
SizeYZCmd->SetRange("Size>0.");
SizeYZCmd->SetUnitCategory("Length");
SizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
NbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
NbLayersCmd->SetGuidance("Set number of layers.");
NbLayersCmd->SetParameterName("NbLayers",false);
NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
NbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this);
UpdateCmd->SetGuidance("Update calorimeter geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(G4State_Idle);
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setField",this);
MagFieldCmd->SetGuidance("Define magnetic field.");
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
MagFieldCmd->SetParameterName("Bz",false);
MagFieldCmd->SetUnitCategory("Magnetic flux density");
MagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN03DetectorMessenger::~ExN03DetectorMessenger()
{
delete NbLayersCmd;
delete AbsMaterCmd; delete GapMaterCmd;
delete AbsThickCmd; delete GapThickCmd;
delete SizeYZCmd; delete UpdateCmd;
delete MagFieldCmd;
delete detDir;
delete N03Dir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN03DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == AbsMaterCmd )
{ ExN03Detector->SetAbsorberMaterial(newValue);}
if( command == GapMaterCmd )
{ ExN03Detector->SetGapMaterial(newValue);}
if( command == AbsThickCmd )
{ ExN03Detector->SetAbsorberThickness(AbsThickCmd
->GetNewDoubleValue(newValue));}
if( command == GapThickCmd )
{ ExN03Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));}
if( command == SizeYZCmd )
{ ExN03Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
if( command == NbLayersCmd )
{ ExN03Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
if( command == UpdateCmd )
{ ExN03Detector->UpdateGeometry(); }
if( command == MagFieldCmd )
{ ExN03Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: ExN03DetectorMessenger.hh,v 1.1 2006/12/01 02:37:01 kmura Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN03DetectorMessenger_h
#define ExN03DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class ExN03DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN03DetectorMessenger: public G4UImessenger
{
public:
ExN03DetectorMessenger(ExN03DetectorConstruction* );
~ExN03DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
ExN03DetectorConstruction* ExN03Detector;
G4UIdirectory* N03Dir;
G4UIdirectory* detDir;
G4UIcmdWithAString* AbsMaterCmd;
G4UIcmdWithAString* GapMaterCmd;
G4UIcmdWithADoubleAndUnit* AbsThickCmd;
G4UIcmdWithADoubleAndUnit* GapThickCmd;
G4UIcmdWithADoubleAndUnit* SizeYZCmd;
G4UIcmdWithAnInteger* NbLayersCmd;
G4UIcmdWithADoubleAndUnit* MagFieldCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:25:12 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyExN03geom.cc,v 1.4 2006/06/29 15:29:21 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyExN03geom.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:25:12 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:25:12 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: QDetectorConstruction.cc,v 1.4 2006/06/29 15:29:24 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// QDetectorConstruction.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: QDetectorConstruction.hh,v 1.4 2006/06/29 15:29:26 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// QDetectorConstruction.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyQgeom.cc,v 1.4 2006/06/29 15:29:29 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyQgeom.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:28:34 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:28:34 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: NISTmaterials.cc,v 1.4 2006/06/29 15:29:32 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// NISTmaterials.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyNISTmaterials.cc,v 1.4 2006/06/29 15:29:34 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyNISTmaterials.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:28:36 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: Qmaterials.cc,v 1.4 2006/06/29 15:29:37 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// Qmaterials.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyQmaterials.cc,v 1.4 2006/06/29 15:29:40 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyQmaterials.cc
//
@@ -0,0 +1,14 @@
# $Id: GNUmakefile,v 1.1 2006/07/12 08:46:18 kmura Exp $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := EMLowEpl#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -0,0 +1,135 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PhysicsListEMlowE.cc,v 1.1 2006/07/12 08:46:18 kmura Exp $
// $Name: geant4-08-02 $
// ====================================================================
// PhysicsListEMlowE.cc
//
// 2006 Q
// ====================================================================
#include "PhysicsListEMlowE.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyRayleigh.hh"
#include "G4LowEnergyIonisation.hh"
#include "G4LowEnergyBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MultipleScattering.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////////////
PhysicsListEMlowE::PhysicsListEMlowE()
//////////////////////////////////////
{
SetVerboseLevel(1);
defaultCutValue = 1.*mm; // default cut value (1.0mm)
}
///////////////////////////////////////
PhysicsListEMlowE::~PhysicsListEMlowE()
///////////////////////////////////////
{
}
///////////////////////////////////////////
void PhysicsListEMlowE::ConstructParticle()
///////////////////////////////////////////
{
G4Gamma::GammaDefinition();
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
}
//////////////////////////////////////////
void PhysicsListEMlowE::ConstructProcess()
//////////////////////////////////////////
{
AddTransportation();
G4ProcessManager* pm;
// ----------------------------------------------------------
// gamma physics
// ----------------------------------------------------------
pm= G4Gamma::Gamma()-> GetProcessManager();
pm-> AddDiscreteProcess(new G4LowEnergyPhotoElectric);
pm-> AddDiscreteProcess(new G4LowEnergyCompton);
pm-> AddDiscreteProcess(new G4LowEnergyGammaConversion);
pm-> AddDiscreteProcess(new G4LowEnergyRayleigh);
// ----------------------------------------------------------
// electron physics
// ----------------------------------------------------------
G4LowEnergyIonisation* eion= new G4LowEnergyIonisation;
G4LowEnergyBremsstrahlung* ebrems= new G4LowEnergyBremsstrahlung;
G4MultipleScattering* msc= new G4MultipleScattering;
pm= G4Electron::Electron()-> GetProcessManager();
pm-> AddProcess(msc, ordInActive, 1, 1);
pm-> AddProcess(eion, ordInActive, 2, 2);
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
// ----------------------------------------------------------
// positron physics
// ----------------------------------------------------------
eion= new G4LowEnergyIonisation;
ebrems= new G4LowEnergyBremsstrahlung;
msc= new G4MultipleScattering;
G4eplusAnnihilation* annihilation= new G4eplusAnnihilation;
pm= G4Positron::Positron()-> GetProcessManager();
pm-> AddProcess(msc, ordInActive, 1, 1);
pm-> AddProcess(eion, ordInActive, 2, 2);
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
pm-> AddProcess(annihilation, 0, ordInActive, 4);
}
/////////////////////////////////
void PhysicsListEMlowE::SetCuts()
/////////////////////////////////
{
SetCutsWithDefault();
}
@@ -23,37 +23,38 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PhysicsListEMlowE.hh,v 1.1 2006/07/12 08:46:18 kmura Exp $
// $Name: geant4-08-02 $
// ====================================================================
// PhysicsListEMlowE.hh
//
// Physics list for electron/positron/gamma
// model: EM-lowE package
//
// 2006 Q
// ====================================================================
#ifndef PHYSICS_LIST_EMLOWE_H
#define PHYSICS_LIST_EMLOWE_H
#include "G4VUserPhysicsList.hh"
// ====================================================================
//
// H02MuonSD.hh
// $Id: H02MuonSD.hh,v 1.3 2006/06/29 17:13:15 gunter Exp $
// class definition
//
// ====================================================================
#ifndef H02_MUON_SD_H
#define H02_MUON_SD_H
#include "G4VSensitiveDetector.hh"
#include "H02MuonHit.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class H02MuonSD : public G4VSensitiveDetector {
private:
H02MuonHitsCollection* hitCollection;
class PhysicsListEMlowE : public G4VUserPhysicsList {
public:
H02MuonSD(G4String name);
~H02MuonSD();
PhysicsListEMlowE();
~PhysicsListEMlowE();
virtual void Initialize(G4HCofThisEvent* HCE);
virtual G4bool ProcessHits(G4Step* astep, G4TouchableHistory* ROhist);
virtual void EndOfEvent(G4HCofThisEvent* HCE);
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
virtual void ConstructParticle();
virtual void ConstructProcess();
virtual void SetCuts();
};
#endif
@@ -23,69 +23,55 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pyEMLowEpl.cc,v 1.2 2006/07/12 09:18:08 kmura Exp $
// $Name: geant4-08-02 $
// ====================================================================
// pyEMLowEpl.cc
//
// G4HepMCAsciiReader.hh
// $Id: G4HepMCAsciiReader.hh,v 1.3 2006/06/29 17:07:58 gunter Exp $
// [Qgeom]
// a site-module of Geant4Py
//
// Electron/Gamma EM-lowE physics list
//
// 2005 Q
// ====================================================================
#ifndef G4_HEPMC_ASCII_READER_H
#define G4_HEPMC_ASCII_READER_H
#include <boost/python.hpp>
#include "G4RunManager.hh"
#include "PhysicsListEMlowE.hh"
#include <fstream>
#include "G4HepMCInterface.hh"
#include <CLHEP/HepMC/ReadHepMC.h>
using namespace boost::python;
class G4HepMCAsciiReaderMessenger;
// ====================================================================
// thin wrappers
// ====================================================================
namespace pyEMLowEpl {
class G4HepMCAsciiReader : public G4HepMCInterface
PhysicsListEMlowE* Construct()
{
protected:
G4String filename;
std::ifstream from;
PhysicsListEMlowE* pl= new PhysicsListEMlowE;
G4int verbose;
G4HepMCAsciiReaderMessenger* messenger;
G4RunManager* runMgr= G4RunManager::GetRunManager();
runMgr-> SetUserInitialization(pl);
virtual HepMC::GenEvent* GenerateHepMCEvent();
return pl;
}
public:
G4HepMCAsciiReader();
~G4HepMCAsciiReader();
// set/get methods
void SetFileName(G4String name);
G4String GetFileName() const;
void SetVerboseLevel(G4int i);
G4int GetVerboseLevel() const;
// methods...
void Initialize();
};
using namespace pyEMLowEpl;
// ====================================================================
// inline functions
// Expose to Python
// ====================================================================
inline void G4HepMCAsciiReader::SetFileName(G4String name)
{
filename= name;
}
BOOST_PYTHON_MODULE(EMLowEpl) {
inline G4String G4HepMCAsciiReader::GetFileName() const
{
return filename;
}
class_<PhysicsListEMlowE, PhysicsListEMlowE*, bases<G4VUserPhysicsList> >
("PhysicsListEMlowE", "Electron/Gamma EM-lowE physics list")
;
inline void G4HepMCAsciiReader::SetVerboseLevel(G4int i)
{
verbose= i;
}
// ---
def("Construct", Construct,
return_value_policy<reference_existing_object>());
inline G4int G4HepMCAsciiReader::GetVerboseLevel() const
{
return verbose;
}
#endif
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:31:40 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: PhysicsListEMstd.cc,v 1.4 2006/06/29 15:29:43 gunter Exp $
// $Name: geant4-08-01 $
// $Id: PhysicsListEMstd.cc,v 1.5 2006/07/11 09:55:01 kmura Exp $
// $Name: geant4-08-02 $
// ====================================================================
// PhysicsListEMstd.cc
//
@@ -38,8 +38,6 @@
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PhysicsListEMstd.hh,v 1.4 2006/06/29 15:29:46 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// PhysicsListEMstd.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyEMSTDpl.cc,v 1.4 2006/06/29 15:29:49 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyEMSTDpl.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ExN01PhysicsList.cc,v 1.4 2006/06/29 15:29:52 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// ExN01PhysicsList.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ExN01PhysicsList.hh,v 1.4 2006/06/29 15:29:55 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// ExN01PhysicsList.hh
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:31:40 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyExN01pl.cc,v 1.4 2006/06/29 15:29:58 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyExN01pl.cc
//
@@ -25,7 +25,7 @@
//
//
// $Id: ExN03PhysicsList.cc,v 1.4 2006/06/29 15:30:01 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
@@ -25,7 +25,7 @@
//
//
// $Id: ExN03PhysicsList.hh,v 1.4 2006/06/29 15:30:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.1 2006/04/25 10:32:41 kmura Exp $
# $Name: geant4-08-01 $
# $Name: geant4-08-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyExN03pl.cc,v 1.3 2006/06/29 15:30:07 gunter Exp $
// $Name: geant4-08-01 $
// $Name: geant4-08-02 $
// ====================================================================
// pyExN03pl.cc
//

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