Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
+1216 -128
View File
File diff suppressed because it is too large Load Diff
+69 -30
View File
@@ -1,34 +1,73 @@
Geant4 Software License
Version 1.0, 28 June 2006
Version 1.0, 28 June 2006
Copyright (c) Copyright Holders of the Geant4 Collaboration, 1994-2006.
See http://cern.ch/geant4/license for details on the copyright holders. All rights not expressly granted under this license are reserved.
This software includes voluntary contributions made to Geant4. See http://cern.ch/geant4 for more information on Geant4.
Installation, use, reproduction, display, modification and redistribution of this software, with or without modification, in source and binary forms, are permitted on a non- exclusive basis. Any exercise of rights by you under this license is subject to the following conditions:
1. Redistributions of this software, in whole or in part, with or without modification, must reproduce the above copyright notice and these license conditions in this software, the user documentation and any other materials provided with the redistributed software.
2. The user documentation, if any, included with a redistribution, must include the following notice:
"This product includes software developed by Members of the Geant4 Collaboration ( http://cern.ch/geant4 )."
If that is where third-party acknowledgments normally appear, this acknowledgment must be reproduced in the modified version of this software itself.
3. The names "Geant4" and "The Geant4 toolkit" may not be used to endorse or promote software, or products derived therefrom, except with prior written permission by license@geant4.org. If this software is redistributed in modified form, the name and reference of the modified version must be clearly distinguishable from that of this software.
4. You are under no obligation to provide anyone with any modifications of this software that you may develop, including but not limited to bug fixes, patches, upgrades or other enhancements or derivatives of the features, functionality or performance of this software. However, if you publish or distribute your modifications without contemporaneously requiring users to enter into a separate written license agreement, then you are deemed to have granted all Members and all Copyright Holders of the Geant4 Collaboration a license to your modifications, including modifications protected by any patent owned by you, under the conditions of this license.
5. You may not include this software in whole or in part in any patent or patent application in respect of any modification of this software developed by you.
See http://cern.ch/geant4/license for details on the copyright holders. All
rights not expressly granted under this license are reserved.
This software includes voluntary contributions made to Geant4.
See http://cern.ch/geant4 for more information on Geant4.
Installation, use, reproduction, display, modification and redistribution of
this software, with or without modification, in source and binary forms, are
permitted on a non-exclusive basis. Any exercise of rights by you under this
license is subject to the following conditions:
1. Redistributions of this software, in whole or in part, with or without
modification, must reproduce the above copyright notice and these license
conditions in this software, the user documentation and any other
materials provided with the redistributed software.
2. The user documentation,if any,included with a redistribution,must include
the following notice:"This product includes software developed by Members
of the Geant4 Collaboration ( http://cern.ch/geant4 )."
If that is where third-party acknowledgments normally appear, this
acknowledgment must be reproduced in the modified version of this
software itself.
3. The names "Geant4" and "The Geant4 toolkit" may not be used to endorse or
promote software,or products derived therefrom, except with prior written
permission by license@geant4.org. If this software is redistributed in
modified form, the name and reference of the modified version must be
clearly distinguishable from that of this software.
4. You are under no obligation to provide anyone with any modifications of
this software that you may develop,including but not limited to bug fixes,
patches, upgrades or other enhancements or derivatives of the features,
functionality or performance of this software. However, if you publish or
distribute your modifications without contemporaneously requiring users
to enter into a separate written license agreement, then you are deemed
to have granted all Members and all Copyright Holders of the Geant4
Collaboration a license to your modifications, including modifications
protected by any patent owned by you,under the conditions of this license.
5. You may not include this software in whole or in part in any patent or
patent application in respect of any modification of this software
developed by you.
6. DISCLAIMER
THIS SOFTWARE IS PROVIDED BY THE MEMBERS AND COPYRIGHT HOLDERS OF THE GEANT4 COLLABORATION AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, OF SATISFACTORY QUALITY, AND FITNESS FOR A PARTICULAR PURPOSE OR USE ARE DISCLAIMED. THE MEMBERS OF THE GEANT4 COLLABORATION AND CONTRIBUTORS MAKE NO REPRESENTATION THAT THE SOFTWARE AND MODIFICATIONS THEREOF, WILL NOT INFRINGE ANY PATENT, COPYRIGHT, TRADE SECRET OR OTHER PROPRIETARY RIGHT.
THIS SOFTWARE IS PROVIDED BY THE MEMBERS AND COPYRIGHT HOLDERS OF THE GEANT4
COLLABORATION AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, OF
SATISFACTORY QUALITY, AND FITNESS FOR A PARTICULAR PURPOSE OR USE ARE
DISCLAIMED. THE MEMBERS OF THE GEANT4 COLLABORATION AND CONTRIBUTORS MAKE NO
REPRESENTATION THAT THE SOFTWARE AND MODIFICATIONS THEREOF,WILL NOT INFRINGE
ANY PATENT, COPYRIGHT, TRADE SECRET OR OTHER PROPRIETARY RIGHT.
7. LIMITATION OF LIABILITY
THE MEMBERS AND COPYRIGHT HOLDERS OF THE GEANT4 COLLABORATION AND CONTRIBUTORS SHALL HAVE NO LIABILITY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA OR PROFITS, OR BUSINESS INTERRUPTION, HOWEVER CAUSED AND ON ANY THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR OTHERWISE, ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
8. This license shall terminate with immediate effect and without notice if you fail to comply with any of the terms of this license, or if you institute litigation against any Member or Copyright Holder of the Geant4 Collaboration with regard to this software.
THE MEMBERS AND COPYRIGHT HOLDERS OF THE GEANT4 COLLABORATION AND
CONTRIBUTORS SHALL HAVE NO LIABILITY FOR DIRECT,INDIRECT,SPECIAL, INCIDENTAL,
CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES OF ANY CHARACTER INCLUDING,
WITHOUT LIMITATION, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE,
DATA OR PROFITS, OR BUSINESS INTERRUPTION, HOWEVER CAUSED AND ON ANY THEORY
OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR
OTHERWISE, ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
8. This license shall terminate with immediate effect and without notice if
you fail to comply with any of the terms of this license, or if you
institute litigation against any Member or Copyright Holder of the Geant4
Collaboration with regard to this software.
+152
View File
@@ -0,0 +1,152 @@
Geant4 8.0 - patch-01 Release Notes
-----------------------------------
10 February 2006
List of fixes included in this public patch since the public release 8.0:
o Digits & Hits:
-------------
+ Added missing methods in G4VDigiCollection and G4TDigiCollection.
Addresses problem report #786.
o Geometry:
--------
+ divisions
o Added missing setting of mother-logical pointer in constructors of
G4PVDivision. Fixes problem report #829.
o Added missing checks for illegal constructs of G4PVDivision (NULL
pointer to mother logical and self-placement).
o Fixed check for generic construct in G4ParameterisationPolycone and
G4ParameterisationPolyhedra: allow it for the automatic replicated
instance.
o Cache information about axis of division and provided accessor method
GetDivisionAxis() in G4PVDivision.
+ navigation
o Addressing problem with convergence in LocateIntersectionPoint()
of G4PropagatorInField. The problem, identified by Atlas, was
observed when requesting high precision, i.e. small values of
eps_min/max, delta_one_step, due to need for small delta_intersection.
Increased maximum iterations (from 100 to 10000) until correct
information can be return an Exception is thrown in case of too many
iterations; a warning is thrown in case over 1000 iterations.
+ solids/BREPS
o Use explicit 'HepGeom' namespace for 'Identity', to allow for
porting on Windows/VC++ when using CLHEP-2.0.X.
+ solids/CSG
o G4Sphere: fixed bug in DistanceToOut() for theta intersections.
Fixes problem report #830.
+ solids/specific
o Fixed visibility of soft edges for visualization of twisted solids.
o G4TwistedTubs and G4VTwistedFaceted::CreatePolyhedron(): changed
parameterised polyhedron mesh approximation in terms of
G4Polyhedron::GetNumberOfRotationSteps().
o Fixes in G4EllipticalCone:
- Changed GetPointOnSurface(), which was not uniform in endcaps.
- Bug fix in Inside(), which was not correct for the elliptic mantel.
Made test similar as in G4EllipticTube.
- Several fixes in DistanceToIn/Out() resolving problems of looping
events.
+ volumes
o G4AssemblyVolume: fixed initialisation of names for placed volumes
which was corrupted after migration to <sstream> as side effect.
o Particles:
---------
+ Bug fix for G4ParticleDefinition, was causing improper behavior of
GetAtomicNumber() method for ions. Fixes problem report #827.
o Electromagnetic processes:
-------------------------
+ standard:
o Fix in G4PolarizedComptonScattering, returning PostStepDoIt()
for G4ComptonScattering52. Fixes problem report #478.
o Hadronic Processes:
------------------
+ management:
o G4HadronicProcess: fixed problem report #611. Problems caused when
hadronic interactions reset stopButAlive particle to Alive.
o Added diagnostics when hadronic exceptions occur in G4HadronicProcess
and G4EnergyRangeManager.
+ models/binary_cascade:
o Fixed problem report #794. Projectile nucleus needs to be centered.
+ models/chiral_inv_phase_space/body:
o Fixed trivial compilation warning.
+ models/de_excitation:
o G4NuclearLevelManager: print a warning if no data file is present.
Addressed problem report #814.
o G4ParaFissionModel: fix for compilation error, following problem
report #817.
+ models/neutron_hp:
o Fixes core dump observed when neutron energy is close to 20 MeV.
+ models/radioactive_decay
o G4NuclearDecayChannel::BetaDecayIt(): check for negative sqrt()
argument in 'daughtermomentum[1]'. Fixes problem report #822.
+ stopping:
o Set process type to be 'fHadronic'. Was not set previously.
+ util:
o G4ReactionDynamics: added array bounds protection in TwoCluster().
o Processes cuts:
--------------
+ Fix in G4VRangeToEnergyConverter::Convert() to recalculate the energy
loss table if new elements are added. Fixes problem report #831.
o Track:
-----
+ G4ParticleChangeForRadDecay is now derived from G4ParticleChangeForDecay.
o Transportation:
--------------
+ G4Transportation: the particle's charge is now taken from the dynamic
particle, so that it can take into account changes from the interaction
of an ion with matter (eg stripping e-).
+ Corrected problem with suspended tracks, addressing problem report #802.
Added StartTracking() method which takes over responsibility to clear
the state for a new track, and to message other relevant component to
clear their state.
o Visualization:
-------------
+ management:
o Fixed bug that omits geometry volumes from file-based visualization
drivers for first /run/beamOn.
o Added friend status for ray-tracer.
+ RayTracer:
o Fix behavior of messengers when RayTracerX is used.
o Allow for multiple ray tracers.
o Separated out the original ray tracer to be used by viewers.
o Data:
----
+ New data set for high-precision neutron processes G4NDL-3.8
o Added Gadorinium data (source ENDF/B-VI).
o Replaced: Inelastic/CrossSection/17_nat_Chlorine and
Inelastic/F10/28_62_Nickel (source ENDF/B-VI).
o Removed: Inelastic/CrossSection/32_70|72|73|74|76_Germanium
o Examples:
--------
+ Updated reference outputs.
+ extended/electromagnetic/TestEm7
o Trivial fix of memory leak.
+ extended/medical/GammaTherapy
o Substituted PreciseRange with CSDARange.
----------------------------------------------------------------------------
Technical Notes
---------------
o This patch should be applied on top of release 8.0.
o Technical notes distributed for release 8.0 are also applicable and
valid for this patch.
The code and rebuilt binary libraries for release 8.0 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.
-7
View File
@@ -883,13 +883,6 @@ please refer to the related History files provided in most packages):
<LI>Fixed (non-)culling of transparent volumes.</LI>
<LI>Implemented radial replicas for G4Tubs.</LI>
</UL></LI>
<LI><B>HepRep</B>
<UL>
<LI>Fix for 'DrawAs' value which was wrong for solids using Geant4
primitives.</LI>
<LI>Fix for cones face wrong way.</LI>
<LI>Fixed compilation warning on MacOSX.</LI>
</UL></LI>
<LI><B>OpenGL</B>
<UL>
<LI>Initial window size can now be set from <TT>/vis/open</TT> and
File diff suppressed because it is too large Load Diff
+17 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.275 2005/12/12 09:15:17 gcosmo Exp $
$Id: History,v 1.278 2006/06/13 15:37:35 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,22 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
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
optional customisation.
- Upgraded Configure internal scripts.
24th April 2006 Gabriele Cosmo (config-V08-00-01)
- binmake.gmk: fixed old-standing warning on WIN32-VC for file extension of
target object file. Defined TARGOBJEXT internal variable defining the
actual extension: .o for UNIX, .OBJ for Windows platforms.
6th April 2006 Gabriele Cosmo (config-V08-00-00)
- Darwin-g++: corrected linker options for generation of dynamic libraries.
Now dynamic libraries on MacOSX finally work. Tested on MacOS 10.4.5 with
gcc-4.0.1.
12th December 2005 Gabriele Cosmo (config-V07-01-07)
- binmake.gmk: added workaround to allow for physics-lists to link
with DLLs on Windows.
+1 -13
View File
@@ -1,4 +1,4 @@
# $Id: architecture.gmk,v 1.104 2005/12/07 09:41:54 gcosmo Exp $
# $Id: architecture.gmk,v 1.105 2006/06/13 15:36:30 gcosmo Exp $
# ------------------------------------------------------------------------
# GEANT 4 - Architecture configuration script for GNU Make
#
@@ -227,17 +227,6 @@ endif
ifndef VISLIBS
VISLIBS :=
endif
# ------------------ X11 ---------------------
X11FLAGS :=
X11LIBS := -lXmu -lXt -lXext -lX11
#
# ----------------- Motif --------------------
XMFLAGS :=
XMLIBS := -lXm
#
# ---------------- Athena --------------------
XAWFLAGS :=
XAWLIBS := -lXaw
#
# ---------------- OpenGL --------------------
# The user can define his own values of OGLFLAGS and OGLLIBS.
@@ -257,7 +246,6 @@ XAWLIBS := -lXaw
# if the package is installed in a location different
# than default system directories (like... /usr or /usr/local).
#
ifndef OIVHOME
OIVHOME := /usr/local/Inventor
endif
+15 -10
View File
@@ -1,4 +1,4 @@
# $Id: binmake.gmk,v 1.109 2005/12/12 09:08:21 gcosmo Exp $
# $Id: binmake.gmk,v 1.112 2006/04/24 10:54:18 gcosmo Exp $
# ----------------------------------------------------------
# Script defining rules and paths for making binaries.
# First implementation: Gabriele Cosmo, 25/06/1998.
@@ -174,15 +174,18 @@ endif
#
ifndef USER_DEFINED_LDLIBS
# TARGETLIB is the library generated for the final user application...
# TARGETLIB is the library generated for the final user application;
# TARGOBJEXT defines the target object extension
#
ifdef G4EXLIB
ifeq (,$(findstring WIN32-VC,$(G4SYSTEM)))
# Unix
TARGETLIB := -l$(G4TARGET)
TARGETLIB := -l$(G4TARGET)
TARGOBJEXT := o
else
# Windows
TARGETLIB := lib$(G4TARGET).a
TARGETLIB := lib$(G4TARGET).a
TARGOBJEXT := OBJ
endif
endif
@@ -294,7 +297,7 @@ include $(G4INSTALL)/config/sys/$(G4SYSTEM)-runpath.gmk
endif
sources := $(wildcard $(G4TARGET).cc)
objects := $(patsubst %.cc,$(G4TMPDIR)/exe/%.o,$(sources))
objects := $(patsubst %.cc,$(G4TMPDIR)/exe/%.$(TARGOBJEXT),$(sources))
dependencies := $(patsubst %.cc,$(G4TMPDIR)/exe/%.d,$(sources))
LINK_DEPENDENCIES := $(G4TMPDIR)/exe/obj.last $(EXTRA_LINK_DEPENDENCIES)
@@ -334,6 +337,8 @@ else
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) \
-o $(G4BINDIR)/$(G4TARGET) $(objects) $(LDFLAGS) \
$(LDLIBS)
@if [ \( -f $(G4BINDIR)/$(G4TARGET) \) ]; then \
echo "... Done!"; fi
endif
# Touch the versioning file
@@ -344,15 +349,15 @@ $(G4TMPDIR)/exe/obj.last: $(objects)
endif
@touch $@
# Make the $(G4TARGET).o file.
$(G4TMPDIR)/exe/$(G4TARGET).o : $(G4TARGET).cc
# Make the $(G4TARGET).$(TARGOBJEXT) file.
$(G4TMPDIR)/exe/$(G4TARGET).$(TARGOBJEXT) : $(G4TARGET).cc
ifdef CPPVERBOSE
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(APPFLAGS) \
-c $(OUT_OBJ)$(G4TMPDIR)/exe/$(G4TARGET).o $(G4TARGET).cc
-c $(OUT_OBJ)$(G4TMPDIR)/exe/$(G4TARGET).$(TARGOBJEXT) $(G4TARGET).cc
else
@echo Compiling $(G4TARGET).cc ...
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(APPFLAGS) \
-c $(OUT_OBJ)$(G4TMPDIR)/exe/$(G4TARGET).o $(G4TARGET).cc
-c $(OUT_OBJ)$(G4TMPDIR)/exe/$(G4TARGET).$(TARGOBJEXT) $(G4TARGET).cc
endif
GPPFLAGS := "-M"
@@ -384,7 +389,7 @@ $(G4TMPDIR)/exe/$(G4TARGET).d: $(G4TARGET).cc
@echo Making dependency for file $< ...
@set -e;\
g++ $(GPPFLAGS) $(CPPFLAGS) -w $< |\
sed 's!$(G4TARGET)\.o!$(G4TMPDIR)/exe/& $@!' >$@;\
sed 's!$(G4TARGET)\.$(TARGOBJEXT)!$(G4TMPDIR)/exe/& $@!' >$@;\
[ -s $@ ] || rm -f $@
ifneq ($(dependencies),)
-include $(dependencies)
+60 -1
View File
@@ -283,6 +283,48 @@ setenv OGLHOME "$g4vis_oglhome"
echo "On this machine the OGLHOME=\$OGLHOME"
endif
#+
if ( X$g4vis_oivhome != X ) then
setenv OIVHOME "$g4vis_oivhome"
echo "On this machine the OIVHOME=\$OIVHOME"
endif
#+
if ( X$g4vis_build_openglxm_driver != X ) then
setenv XMFLAGS "$g4vis_xmflags"
echo "On this machine the XMFLAGS=\$XMFLAGS"
endif
#+
if ( X$g4vis_build_openglxm_driver != X ) then
setenv XMLIBS "$g4vis_xmlibs"
echo "On this machine the XMLIBS=\$XMLIBS"
endif
#+
if ( X$g4ui_build_xm_session != X ) then
setenv XMFLAGS "$g4vis_xmflags"
echo "On this machine the XMFLAGS=\$XMFLAGS"
endif
#+
if ( X$g4ui_build_xm_session != X ) then
setenv XMLIBS "$g4vis_xmlibs"
echo "On this machine the XMLIBS=\$XMLIBS"
endif
#+
if ( X$g4ui_build_xaw_session != X ) then
setenv XAWFLAGS "$g4ui_xawflags"
echo "On this machine the XAWFLAGS=\$XAWFLAGS"
endif
#+
if ( X$g4ui_build_xaw_session != X ) then
setenv XAWLIBS "$g4ui_xawlibs"
echo "On this machine the XAWLIBS=\$XAWLIBS"
endif
#
# Use G3TOG4 module
#
@@ -336,7 +378,7 @@ echo "On this machine the G4LIB_USE_GRANULAR=\$G4LIB_USE_GRANULAR"
endif
# Check for Windows!
if ( "X$G4SYSTEM" != "XWIN32-VC" && "X$G4SYSTEM" != "XWIN32-VC7" ) then
if ( "X\$G4SYSTEM" != "XWIN32-VC" && "X\$G4SYSTEM" != "XWIN32-VC7" ) then
setenv G4UI_USE_TCSH 1
echo "On this machine the G4UI_USE_TCSH=\$G4UI_USE_TCSH"
endif
@@ -348,6 +390,7 @@ endif
: In the following dollars and backticks do not need the extra backslash.
$spitshell >>env.csh <<'!NO!SUBS!'
#+
#
# G4WORKDIR
@@ -369,6 +412,22 @@ setenv G4WORKDIR $HOME/geant4
endif
endif
#
# Shared libraries
#
if ( ${?G4LIB_BUILD_SHARED} ) then
if ( ${?LD_LIBRARY_PATH} ) then
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
else
setenv LD_LIBRARY_PATH ${G4LIB}/${G4SYSTEM}
endif
endif
#
# For BIN
#
setenv PATH ${PATH}:${G4WORKDIR}/bin/${G4SYSTEM}
!NO!SUBS!
chmod 755 env.csh
$eunicefix env.csh
+84 -1
View File
@@ -399,6 +399,69 @@ echo "On this machine the OGLHOME=\$OGLHOME"
fi
fi
#+
if [ X$g4vis_oivhome != X ] ; then
OIVHOME="$g4vis_oivhome"
export OIVHOME
if [ X\$g4non_display = X ] ; then
echo "On this machine the OIVHOME=\$OIVHOME"
fi
fi
#+
if [ X$g4vis_build_openglxm_driver != X ] ; then
XMFLAGS="$g4vis_xmflags"
export XMFLAGS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XMFLAGS=\$XMFLAGS"
fi
fi
#+
if [ X$g4vis_build_openglxm_driver != X ] ; then
XMLIBS="$g4vis_xmlibs"
export XMLIBS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XMLIBS=\$XMLIBS"
fi
fi
#+
if [ X$g4ui_build_xm_session != X ] ; then
XMFLAGS="$g4vis_xmflags"
export XMFLAGS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XMFLAGS=\$XMFLAGS"
fi
fi
#+
if [ X$g4vis_build_xm_session != X ] ; then
XMLIBS="$g4vis_xmlibs"
export XMLIBS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XMLIBS=\$XMLIBS"
fi
fi
#+
if [ X$g4ui_build_xaw_session != X ] ; then
XAWFLAGS="$g4ui_xawflags"
export XAWFLAGS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XAWFLAGS=\$XAWFLAGS"
fi
fi
#+
if [ X$g4ui_build_xaw_session != X ] ; then
XAWLIBS="$g4ui_xawlibs"
export XAWLIBS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XAWLIBS=\$XAWLIBS"
fi
fi
#
# Use G3TOG4 module
#
@@ -469,7 +532,7 @@ fi
fi
# Check for Windows!
if test "X$G4SYSTEM" != "XWIN32-VC" -a "X$G4SYSTEM" != "XWIN32-VC7"; then
if test "X\$G4SYSTEM" != "XWIN32-VC" -a "X\$G4SYSTEM" != "XWIN32-VC7"; then
#+
#
# UI_USE_TCSH for Unix
@@ -488,6 +551,7 @@ fi
: In the following dollars and backticks do not need the extra backslash.
$spitshell >>env.sh <<'!NO!SUBS!'
#+
#
# G4WORKDIR
@@ -520,6 +584,25 @@ fi
fi
#
# Shared libraries
#
if [ $G4LIB_BUILD_SHARED ] ; then
if [ $LD_LIBRARY_PATH ] ; then
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${G4LIB}/${G4SYSTEM}
export LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=${G4LIB}/${G4SYSTEM}
export LD_LIBRARY_PATH
fi
fi
#
# For BIN
#
PATH=${PATH}:${G4WORKDIR}/bin/${G4SYSTEM}
export PATH
!NO!SUBS!
chmod 755 env.sh
$eunicefix env.sh
+63
View File
@@ -324,6 +324,69 @@ export OGLHOME
echo "On this machine the OGLHOME=\$OGLHOME"
fi
#+
if [ X$g4vis_oivhome != X ] ; then
OIVHOME="$g4vis_oivhome"
export OIVHOME
if [ X\$g4non_display = X ] ; then
echo "On this machine the OIVHOME=\$OIVHOME"
fi
fi
#+
if [ X$g4vis_build_openglxm_driver != X ] ; then
XMFLAGS="$g4vis_xmflags"
export XMFLAGS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XMFLAGS=\$XMFLAGS"
fi
fi
#+
if [ X$g4vis_build_openglxm_driver != X ] ; then
XMLIBS="$g4vis_xmlibs"
export XMLIBS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XMLIBS=\$XMLIBS"
fi
fi
#+
if [ X$g4ui_build_xm_session != X ] ; then
XMFLAGS="$g4vis_xmflags"
export XMFLAGS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XMFLAGS=\$XMFLAGS"
fi
fi
#+
if [ X$g4vis_build_xm_session != X ] ; then
XMLIBS="$g4vis_xmlibs"
export XMLIBS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XMLIBS=\$XMLIBS"
fi
fi
#+
if [ X$g4ui_build_xaw_session != X ] ; then
XAWFLAGS="$g4ui_xawflags"
export XAWFLAGS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XAWFLAGS=\$XAWFLAGS"
fi
fi
#+
if [ X$g4ui_build_xaw_session != X ] ; then
XAWLIBS="$g4ui_xawlibs"
export XAWLIBS
if [ X\$g4non_display = X ] ; then
echo "On this machine the XAWLIBS=\$XAWLIBS"
fi
fi
#
# Use G3TOG4 module
#
+18 -6
View File
@@ -16,12 +16,24 @@ ifeq ($(G4SYSTEM),AIX-xlC)
FC := xlf
FCFLAGS += -qextname
FCLIBS := -lxlf90 -lxlf
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/lib -lXmu -lX11 -lXext
XMFLAGS := -I/usr/include/Motif1.2
XMLIBS := -L/usr/lib -lXm -lXt -lX11
XAWFLAGS := -I/usr/include/X11
XAWLIBS := -L/usr/lib -lXaw -lXmu -lXt -lX11 -lXext
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/lib -lXmu -lX11 -lXext
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/include/Motif1.2
endif
ifndef XMLIBS
XMLIBS := -L/usr/lib -lXm -lXt -lX11
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/include/X11
endif
ifndef XAWLIBS
XAWLIBS := -L/usr/lib -lXaw -lXmu -lXt -lX11 -lXext
endif
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
+21 -4
View File
@@ -13,11 +13,29 @@ ifeq ($(G4SYSTEM),DEC-cxx)
endif
endif
CXXFLAGS += -ieee -timplicit_local
CXXFLAGS += -std strict_ansi
SHEXT := so
#future G4RUNPATHOPTION := -rpath
G4RUNPATHOPTION := -rpath
FC := f77
FCLIBS := -lUfor -lfor -lFutil -lots
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -lXmu -lXt -lXext -lX11
endif
ifndef XMFLAGS
XMFLAGS :=
endif
ifndef XMLIBS
XMLIBS := -lXm
endif
ifndef XAWFLAGS
XAWFLAGS :=
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
# OGLFLAGS := -I/usr/include -I/usr/local/include
@@ -26,7 +44,6 @@ ifeq ($(G4SYSTEM),DEC-cxx)
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
# OGLLIBS := -lMesaGLU -lMesaGL
endif
CXXFLAGS += -std strict_ansi
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
@@ -35,6 +52,6 @@ ifeq ($(G4SYSTEM),DEC-cxx)
endef
# transform-RPath = 1
define build-global-shared-lib
@echo "Global shared Libraries not yet supported on $(G4SYSTEM)
@echo "Global shared Libraries not supported on $(G4SYSTEM)
endef
endif
+34 -55
View File
@@ -1,22 +1,20 @@
#
# ------ MacOS-X ------ !!! not generally supported !!!
# ------ MacOS-X ------
# MacOS 10.3 gcc-3.3
# MacOS 10.4 gcc-4.0
# Uses default MacOS-X compiler (g++).
# Includes commands to build the .dylib (MacOS-X shared libs)
#
# Use echo -n (there is not the 'echo -e' option of Linux)
#
# Author: Helmut Burkhardt - CERN
# Original author: Helmut Burkhardt - CERN
# Revisions: Guy Barrand - LAL
# Gabriele Cosmo - CERN
#
ifeq ($(G4SYSTEM),Darwin-g++)
CXX := g++
CXXFLAGS := -Wall -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
ifdef G4OPTIMISE
CXXFLAGS += -O
FCFLAGS := -O
CCFLAGS := -O
CXXFLAGS += -O2
FCFLAGS := -O2
CCFLAGS := -O2
else
ifdef G4DEBUG
CXXFLAGS += -g
@@ -31,15 +29,31 @@ ifeq ($(G4SYSTEM),Darwin-g++)
endif
FC := g77
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
LDFLAGS += -bind_at_load
FCLIBS := -lg2c -lnsl
ECHO := /bin/echo -n
SHEXT := dylib
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
XMFLAGS := -I/sw/include
# XMFLAGS := -I/usr/X11R6/include ##### some installations.
XMLIBS := -L/sw/lib -lXm -lXpm
# XMLIBS := -L/usr/X11R6/lib -lXm -lXpm ##### some installations.
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/sw/include
# XMFLAGS := -I/usr/X11R6/include ##### some installations.
endif
ifndef XMLIBS
XMLIBS := -L/sw/lib -lXm -lXpm
# XMLIBS := -L/usr/X11R6/lib -lXm -lXpm ##### some installations.
endif
ifndef XAWFLAGS
XAWFLAGS := -I/sw/include
# XAWFLAGS := -I/usr/X11R6/include ##### some installations.
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
DLDLIBS := -ldl
ifndef OGLHOME
OGLHOME := /usr/X11R6
@@ -50,53 +64,18 @@ ifeq ($(G4SYSTEM),Darwin-g++)
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
#
# There are two ways to build shared libs (.dylib) on MacOSX.
# Up to now the "flat_namespace" option had been used ; but
# due to the fact that Apple promotes now the "two_level_namespace"
# way of doing, we had tried to build the shared libs in this way.
# But it appears that for the moment this option induces
# unresolved early crashes at runtim. These crashes are
# probably due to a problem in the sequence of execution
# of constructor of static objects that are now heavily
# used in Geant4.
# Waiting a solution to that, we put the "flat_namespace"
# way of doing as the default to build the .dylib (knowing
# that it is anyway not a long term solution).
# G.Barrand (16/07/2004)
#
#### G4_MACOSX_TWO_LEVEL_NAMESPACE = 1
ifdef G4_MACOSX_TWO_LEVEL_NAMESPACE
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
g++ -dynamiclib -twolevel_namespace -undefined define_a_way -dynamic \
-single_module -o $$libdir/$(@F) *.o -L$(G4LIB)/$(G4SYSTEM) \
-L$(CLHEP_LIB_DIR) -l$(CLHEP_LIB) $(INTYLIBS)
g++ -dynamiclib -single_module -undefined dynamic_lookup \
-o $$libdir/$(@F) $(INTYLIBS) *.o
endef
else
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
g++ -dynamiclib -flat_namespace -undefined suppress -dynamic -single_module -o $$libdir/$(@F) $(INTYLIBS) *.o
endef
endif
ifdef G4_MACOSX_TWO_LEVEL_NAMESPACE
define build-global-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMP)/$(G4SYSTEM); \
g++ -dynamiclib -twolevel_namespace -undefined error -dynamic \
-single_module -o $$libdir/$(@F) \
$(foreach dir,$(SUBLIBS),$(dir)/*.o) -L$(G4LIB)/$(G4SYSTEM) \
$(patsubst lib%,-l%,$(patsubst %.lib,%,$(GLOBLIBS))) \
-L$(CLHEP_LIB_DIR) -l$(CLHEP_LIB) $(INTYLIBS);
g++ -dynamiclib -single_module -undefined dynamic_lookup \
-o $$libdir/$(@F) $(INTYLIBS) $(foreach dir,$(SUBLIBS),$(dir)/*.o);
endef
else
define build-global-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMP)/$(G4SYSTEM); \
g++ -dynamiclib -flat_namespace -undefined suppress -dynamic -single_module -o $$libdir/$(@F) $(INTYLIBS) $(foreach dir,$(SUBLIBS),$(dir)/*.o);
endef
endif
endif
+20 -8
View File
@@ -14,6 +14,7 @@ ifeq ($(G4SYSTEM),HP-aCC)
endif
CXXFLAGS += +DAportable +W823
CPPFLAGS += -I/usr
CPPFLAGS += -DG4NOT_ISO_DELETES -DG4NO_ISO_VECDIST
ifdef G4LIB_BUILD_SHARED
CXXFLAGS += +Z
FCFLAGS += +Z
@@ -23,13 +24,25 @@ ifeq ($(G4SYSTEM),HP-aCC)
SHEXT := sl
FCFLAGS += +E6 +ppu
CCFLAGS += -Ae +DAportable
X11FLAGS := -I/usr/include/X11/extensions -I/usr/contrib/X11R6/include
X11FLAGS += -I/usr/contrib/X11R6/include/X11
X11LIBS := -L/usr/contrib/X11R6/lib -lXmu -L/usr/lib -lXt -lXext -lX11
XMFLAGS := -I/usr/include/Motif1.2
XMLIBS := -L/usr/lib/Motif1.2_R6 -lXm
XAWFLAGS := -I/usr/contrib/X11R6/include -I/usr/contrib/X11R6/include/X11
XAWLIBS := -L/usr/contrib/X11R6/lib -lXaw
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/contrib/X11R6/include
X11FLAGS += -I/usr/contrib/X11R6/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/contrib/X11R6/lib -lXmu -L/usr/lib -lXt -lXext -lX11
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/include/Motif1.2
endif
ifndef XMLIBS
XMLIBS := -L/usr/lib/Motif1.2_R6 -lXm
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/contrib/X11R6/include -I/usr/contrib/X11R6/include/X11
endif
ifndef XAWLIBS
XAWLIBS := -L/usr/contrib/X11R6/lib -lXaw
endif
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
@@ -37,7 +50,6 @@ ifeq ($(G4SYSTEM),HP-aCC)
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
OGLLIBS += -L/opt/graphics/common/lib -lXwindow -lhpgfx -lXhp11 -ldld
endif
CPPFLAGS += -DG4NOT_ISO_DELETES -DG4NO_ISO_VECDIST
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
+18 -5
View File
@@ -31,10 +31,24 @@ ifeq ($(G4SYSTEM),Linux-egcs)
FCLIBS := -lg2c -lnsl
ECHO := /bin/echo -e
SHEXT := so
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
XMFLAGS := -I/usr/X11R6/include
XMLIBS := -lXm -lXpm
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/X11R6/include
endif
ifndef XMLIBS
XMLIBS := -lXm -lXpm
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/X11R6/include
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
DLDLIBS := -ldl
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
@@ -42,7 +56,6 @@ ifeq ($(G4SYSTEM),Linux-egcs)
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
OIVFLAGS += -I$(OIHOME)/include
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
+18 -5
View File
@@ -42,10 +42,24 @@ ifeq ($(G4SYSTEM),Linux-g++)
FCLIBS := -lg2c -lnsl
ECHO := /bin/echo -e
SHEXT := so
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
XMFLAGS := -I/usr/X11R6/include
XMLIBS := -lXm -lXpm
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/X11R6/include
endif
ifndef XMLIBS
XMLIBS := -lXm -lXpm
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/X11R6/include
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
DLDLIBS := -ldl
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
@@ -53,7 +67,6 @@ ifeq ($(G4SYSTEM),Linux-g++)
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
OIVFLAGS += -I$(OIHOME)/include
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
+18 -5
View File
@@ -33,10 +33,24 @@ ifeq ($(G4SYSTEM),Linux-icc)
AR := xiar r
ECHO := /bin/echo -e
SHEXT := so
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
XMFLAGS := -I/usr/X11R6/include
XMLIBS := -lXm -lXpm
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/X11R6/include
endif
ifndef XMLIBS
XMLIBS := -lXm -lXpm
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/X11R6/include
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
DLDLIBS := -ldl
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
@@ -44,7 +58,6 @@ ifeq ($(G4SYSTEM),Linux-icc)
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
OIVFLAGS += -I$(OIHOME)/include
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
+19 -4
View File
@@ -13,19 +13,34 @@ ifeq ($(G4SYSTEM),SGI-CC)
endif
endif
CXXFLAGS += -ptused
CPPFLAGS += -DSOCKET_IRIX_SOLARIS
FC := f77
FCLIBS := -lftn
SHEXT := so
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/lib -lXmu -lXt -lXext -lX11
XMLIBS := -L/usr/lib -lXm
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/lib -lXmu -lXt -lXext -lX11
endif
ifndef XMFLAGS
XMFLAGS :=
endif
ifndef XMLIBS
XMLIBS := -L/usr/lib -lXm
endif
ifndef XAWFLAGS
XAWFLAGS :=
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
ifndef OGLFLAGS
OGLFLAGS :=
endif
ifndef OGLLIBS
OGLLIBS := -L/usr/lib -lGLU -lGL
endif
CPPFLAGS += -DSOCKET_IRIX_SOLARIS
define build-granular-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
+21 -11
View File
@@ -17,6 +17,8 @@ ifeq ($(G4SYSTEM),SUN-CC)
FCFLAGS += -KPIC
CCFLAGS += -KPIC
endif
CPPFLAGS += -DSOCKET_IRIX_SOLARIS
CPPFLAGS += -DG4NOT_ISO_DELETES -DG4NO_ISO_VECDIST
G4RUNPATHOPTION := -R
FC := f77
SHEXT := so
@@ -24,24 +26,32 @@ ifeq ($(G4SYSTEM),SUN-CC)
ECHO := /bin/echo
GREP := /usr/xpg4/bin/grep
FCLIBS := -lM77 -lF77 -lsunmath
X11FLAGS := -I/usr/openwin/include/X11/extensions -I/usr/openwin/include/X11
X11FLAGS += -I/usr/openwin/include
X11LIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib
X11LIBS += -R/usr/openwin/lib -lXmu -lX11 -lXext
XMLIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib
XMLIBS += -R/usr/openwin/lib -lXt -lXm -lX11
XAWFLAGS := -I/usr/openwin/include/X11
XAWLIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib
XAWLIBS += -R/usr/openwin/lib -lXaw -lXmu -lXt -lX11 -lXext
ifndef X11FLAGS
X11FLAGS := -I/usr/openwin/include/X11/extensions -I/usr/openwin/include/X11
X11FLAGS += -I/usr/openwin/include
endif
ifndef X11LIBS
X11LIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib
X11LIBS += -R/usr/openwin/lib -lXmu -lX11 -lXext
endif
ifndef XMLIBS
XMLIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib
XMLIBS += -R/usr/openwin/lib -lXt -lXm -lX11
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/openwin/include/X11
endif
ifndef XAWLIBS
XAWLIBS := -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib
XAWLIBS += -R/usr/openwin/lib -lXaw -lXmu -lXt -lX11 -lXext
endif
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
CPPFLAGS += -DSOCKET_IRIX_SOLARIS
LOADLIBS += -lsunmath -lsocket -lnsl
CPPFLAGS += -DG4NOT_ISO_DELETES -DG4NO_ISO_VECDIST
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
+18 -5
View File
@@ -31,17 +31,30 @@ ifeq ($(G4SYSTEM),WIN32-g++)
FCLIBS := -lg2c -lnsl
ECHO := echo -e
SHEXT := so
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
XMFLAGS := -I/usr/X11R6/include
XMLIBS := -lXm -lXpm
ifndef X11FLAGS
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
endif
ifndef X11LIBS
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
endif
ifndef XMFLAGS
XMFLAGS := -I/usr/X11R6/include
endif
ifndef XMLIBS
XMLIBS := -lXm -lXpm
endif
ifndef XAWFLAGS
XAWFLAGS := -I/usr/X11R6/include
endif
ifndef XAWLIBS
XAWLIBS := -lXaw
endif
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
OIVFLAGS += -I$(OIHOME)/include
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
+53 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.13 2004/11/27 04:10:32 hajime Exp $
$Id: History,v 1.24 2006/06/29 06:15:06 kmura Exp $
-------------------------------------------------------------------
=========================================================
@@ -18,6 +18,58 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
envs-V08-00-09 29 June 2006 Koichi Murakami
[g4py]
- fix rpath of boost_python (config/sys/linux.gmk, linuxx8664gcc.gmk)
- "site-modules/primaries/MedicalBeam/MedicalMeam.cc"
fix a bug in calculation of cos from a sin value
- remove duplicated DISCLAIMER (ExN03PhysicsList.cc/hh in site-modules)
envs-V08-00-08 23 June 2006 Hajime Yoshida
- MOMO.jar is now without Gain
- MomoHome/vis.mac revbised for new vis (taken from N03)
[g4py]
- sh version of configure script
- G4UserStackingAction: fixed for not being called
envs-V08-00-07 14 June 2006 Koichi Murakami
[g4py]
- change install path of site-modules (lib/site-modules -> lib/)
- remove COPYING
- update examples/education/lesson2
envs-V08-00-06 13 June 2006 Koichi Murakami
[g4py]
- update expose of G4Track
- change python calls pass-by-reference
(XXXUserAction::XXXAction())
envs-V08-00-05 07 June 2006 Koichi Murakami
- [g4py] fix segmentation fault at termination
envs-V08-00-04 05 June 2006 Koichi Murakami
- [g4py] additional moddifications of g4py for G4 8.1 (08-00-ref-05)
envs-V08-00-03 05 June 2006 Koichi Murakami
- History file is updated.
- same as the previous
envs-V08-00-02 05 June 2006 Koichi Murakami
[g4py]
- modifications for new version (8.1) (08-00-ref-04)
- disclamer is added
envs-V08-00-01 03 June 2006 Hajime Yoshida
- addition of new Geant4Py educational examples
-- g4py/examples/education/lesson1 => measurement of the mass attenuation coefficient
-- g4py/examples/education/lesson2 => Pythonized novice/N03
envs-V08-00-00 28 February 2006 Hajime Yoshida
-addition of new Python environments
-- g4py/source : Python wrappers of geant4/sources
-- g4py/site-modules : some application modules using the wrappers
-- g4py/ associated files to configure
envs-V06-02-00 27 November 2004 Hajime Yoshida
-old depricated files
-new tag number
Binary file not shown.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// Taken from
// $Id: MomoEventAction.hh,v 1.1 2003/11/04 09:02:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: MomoEventAction.hh,v 1.2 2006/06/29 15:27:31 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
#ifndef MomoEventAction_h
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// This code implementation is the intellectual property of
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// Taken after
// $Id: MomoRunAction.hh,v 1.1 2003/11/04 09:02:27 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: MomoRunAction.hh,v 1.2 2006/06/29 15:27:45 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
#ifndef MomoRunAction_h
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// This code implementation is the intellectual property of
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
+14 -11
View File
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
//##### MOMO Main program #####
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// Taken from
// $Id: MomoEventAction.cc,v 1.1 2003/11/04 09:02:27 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: MomoEventAction.cc,v 1.2 2006/06/29 15:27:54 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// This code implementation is the intellectual property of
+16 -13
View File
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// Taken from
// $Id: MomoRunAction.cc,v 1.1 2003/11/04 09:02:27 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: MomoRunAction.cc,v 1.2 2006/06/29 15:28:02 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// This code implementation is the intellectual property of
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
//***** Generated by Geant4 Geometry Editor at Fri Nov 26 11:51:46 JST 2004 *****
+25 -7
View File
@@ -1,10 +1,11 @@
#
# Macro file for the initialization phase of "exampleN02.cc"
# when runing in interactive mode
# Macro file for the initialization phase of "exampleN03.cc"
# when running in interactive mode
#
# Sets some default verbose
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
# create empty scene
@@ -14,18 +15,35 @@
# Create a scene handler for a specific graphics system
# (Edit the next line(s) to choose another graphic system)
#
# Use this open statement to get an .eps and .prim files
# suitable for viewing in DAWN.
/vis/open DAWNFILE
#
# Use this open statement instead for OpenGL in immediate mode.
/vis/open OGLIX
#
####/vis/open DAWNFILE
# Use this open statement instead to get a HepRep version 1 file
# suitable for viewing in WIRED.
#/vis/open HepRepFile
#
# draw scene
# Use this open statement instead to get a HepRep version 2 file
# suitable for viewing in WIRED.
#/vis/open HepRepXML
#
/vis/viewer/set/viewpointThetaPhi 90 180 deg
/vis/viewer/zoom 1.4
# Output an empty detector
/vis/viewer/flush
#
# for drawing the tracks
# (if too many tracks cause core dump => storeTrajectory 0)
#
/tracking/storeTrajectory 1
/vis/scene/endOfEventAction accumulate
#
# At end of each run, an automatic flush causes graphical output.
#/run/beamOn 1
# When you exit Geant4, you will find a file called scene-0.heprep.zip.
# Unzipping this will give you three separate HepRep files suitable for
# viewing in WIRED.
# The first file will contain just detector geometry.
# The second file will contain the detector plus one event.
# The third file will contain the detector plus ten events.
+157
View File
@@ -0,0 +1,157 @@
$Id: 00README,v 1.4 2006/06/14 01:28:37 kmura Exp $
==========================================================================
Geant4Py
Geant4Py is a set of python modules for using Geant4.
==========================================================================
URL
---
http://www-geant4.kek.jp/projects/Geant4Py/
System Requirements:
-------------------
Python
- only 2.x is tested.
Geant4
- 7.0 or later
- should be built in "global" and "shared" libraries.
- All header files should be collected into $(G4INSTALL)/include
by "make includes"
CLHEP
- 1.9.1.1 or later
- should be built in shared library.
- Building shared objects is supported since version 1.9.
BOOST-Python
- version 1.32 or later
(Optional)
ROOT
How to Install:
---------------
There is a configuraton script for building the package.
# ./configure --help
shows help message;
`configure' configures Geant4Py to adapt to many kinds of systems.
Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]...
SYSTEM: System type (see Supported Arhitectures)
Options:
-h, --help Display this help and exit
Installation directories:
--prefix=PREFIX Installation prefix [./]
--libdir=DIR Python modules installaion dir [PREFIX/lib]
--incdir=DIR Header installaion dir [PREFIX/include]
Fine tuning of the library path:
--with-g4-incdir=DIR Geant4 header dir [$G4INCLUDE]
--with-g4-libdir=DIR Geant4 library dir [$G4LIB/$G4SYSTEM]
--with-g4-version=NUM Geant4 version (700/701/710/711)
Not required after ver.8.0
--with-clhep-incdir=DIR CLHEP header dir [$CLHEP_INCLUDE_DIR]
--with-clhep-libdir=DIR CLHEP library dir [$CLHEP_LIB_DIR]
--with-clhep-lib=LIB library name of libCLHEP.so [CLHEP|$CLHEP_LIB]
--with-python-incdir=DIR Python header dir [/usr/include/python],
(location of pyconfig.h)
--with-python-libdir=DIR Python library dir [/usr/lib]
--with-boost-incdir=DIR BOOST-C++ header dir [/usr/include],
(location of boost/)
--with-boost-libdir=DIR BOOST-C++ library dir [/usr/lib]
--with-boost-python-lib=LIB library name of libboost_python.so [boost_python]
--with-package-dir=DIR Geant4 Package dir
Enable/disable options: prefix with either --enable- or --disable-
openglx OpenGL support [auto]
openglxm OpenGLXm support [disable, $G4VIS_USE_OPENGLXM]
raytracerx RayTracerX support [disable, $G4VIS_USE_RAYTRACERX]
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)
You can specify all parameters adopting your environment.
For example,
# ./configure linux
--with-g4-incdir=/opt/heplib/Geant4/geant4.8.1/include
--with-g4-libdir=/opt/heplib/Geant4/geant4.8.1/slib/Linux-g++
--with-clhep-incdir=/opt/heplib/CLHEP/2.0.2.2/include
--with-clhep-libdir=/opt/heplib/CLHEP/2.0.2.2/lib
--with-clhep-lib=CLHEP-2.0.2.2
The configuration script will create config/config.gmk, which describes
your envrionment.
After executing the configure script, then
# make
# make install
That's all!
How to Use:
-----------
Some environment variables are required at run time.
* PYTHONPATH
Python module search directories, given by a colon-separated list
of directories.
Practically, $(INSTALL_PATH)/lib is ok.
* LD_LIBRARY_PATH
Additional shared library path to be searched.
Some libraries paths are already specified via "-rpath" linker option,
so these paths do not have to be added to "LD_LIBRARY_PATH".
* Geant4
* CLHEP
* Boost
* $(INSTALL_PATH)/lib
* $(G4PY_EXLIB_LIBDIR) specified in a module makefile.
You can import Geant4Py modules in Python just like
>>> import Geant4
or
>>> from Geant4 import *
Notes:
-----
1) >> IMPORTANT <<
All users' libraries should be build in shared libaries.
2) Development Environment:
OS: SuSE Linux 10.1 (x86-64)
g++ : 4.1.0
Python: 2.4.2
CLHEP: 1.9.2.2 / 2.0.2.2
BOOST-Python: 1.33.1
ROOT: 5.10/00
Have A Fun!!
Koichi Murakami <Koichi.Murakami@kek.jp>
+6
View File
@@ -0,0 +1,6 @@
Copy Right (C) 2004-2005 Koichi Murakami <Koichi.Murakami@kek.jp>
Contributors:
H.Yoshida, G.Iwai
A special thanks goes to the Geant4 Collaboration.
+24
View File
@@ -0,0 +1,24 @@
# $Id: GNUmakefile,v 1.1 2006/02/27 09:29:42 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py
# ===========================================================
include ./config/config.gmk
SUBDIR := source site-modules
.PHONY: all install clean uninstall
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
uninstall:
@-\rm -f -r $(Q_LIBDIR)
@-\rm -f -r $(Q_INCDIR)
+55
View File
@@ -0,0 +1,55 @@
$Id: History,v 1.14 2006/06/29 02:04:49 kmura Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Geant4Py History file
---------------------
Geant4Py is a Geant4-Python bridge.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
29 June 2006 K.Murakami
- "site-modules/primaries/MedicalBeam/MedicalMeam.cc"
fix a bug in calculation of cos from a sin value
- remove duplicated DISCLAIMER (ExN03PhysicsList.cc/hh in site-modules)
27 June 2006 K.Murakami
- fix rpath of boost_python (config/sys/linux.gmk, linuxx8664gcc.gmk)
21 June 2006 K.Murakami
- sh version of configure script
- G4UserStackingAction: fixed for not being called
14 June 2006 K.Murakami
- update 00README
- update expose of G4Track
- change python calls pass-by-reference
(XXXUserAction::XXXAction())
- change install path of site-modules (lib/site-modules -> lib/)
- remove COPYING
- update examples/education/lesson2
07 June 2006 K.Murakami
- fix segmentation fault at termination
(XXUserAction-s, GraphicSystem-s)
05 June 2006 K.Murakami
- add disclaimer for .cc/.hh files
- some modifications for 08-00-ref-05
(G4FieldManager/G4EmCalculator/G4VPhysicalVolume/G4ParticleDefinition)
25 April 2006 K.Murakami
- update to a revised version (local tag: g4py-weekly-23-Apr-06)
- Directory structure is slightly modified.
- some classes are newly exposed.
- some new examples are added.
27 February 2006 K.Murakami
- commit the first version (local tag: g4py-27-feb-06)
+23
View File
@@ -0,0 +1,23 @@
# $Id: build.gmk,v 1.2 2006/04/25 05:53:05 kmura Exp $
# ===========================================================
# Script for building a module
# ===========================================================
headers := $(wildcard *.hh)
sources := $(wildcard *.cc)
objects := $(patsubst %.cc, %.o, $(sources))
.PHONY: clean debug
module_name := $(MODULE).$(soext)
$(module_name) : $(objects)
$(build-module)
module : $(module_name)
clean :
@-rm -f $(module_name)
@-rm -f $(objects)
debug:
@echo debug...
+47
View File
@@ -0,0 +1,47 @@
# $Id: g4compile.gmk,v 1.1 2006/04/25 05:53:05 kmura Exp $
# ===========================================================
# Script for building a Boost-Python module
# ===========================================================
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
# include/lib directives started...
INCFLAGS := -I.
LOPT :=
# Geant4
G4PY_INCFLAGS := -I$(Q_G4_INCDIR)
# CLHEP
G4PY_INCFLAGS += -I$(Q_CLHEP_INCDIR)
G4PY_LOPT += -L$(Q_CLHEP_LIBDIR) -l$(Q_CLHEP_LIB)
# geant4 version
G4PY_INCFLAGS += -I$(G4PY_INSTALL)/source/version
# finished
CXXFLAGS += $(INCFLAGS)
CXXFLAGS += $(G4PY_INCFLAGS)
LOPT += $(G4PY_LOPT)
# Geant4 version
ifdef Q_G4_VERSION
CXXFLAGS += -DG4VERSION_NUMBER=$(Q_G4_VERSION)
endif
# ===========================================================
# Script for building a module
# ===========================================================
headers := $(wildcard *.hh)
sources := $(wildcard *.cc)
objects := $(patsubst %.cc, %.o, $(sources))
.PHONY: clean debug
all : $(objects)
clean :
@-rm -f $(objects)
debug:
@echo debug...
+37
View File
@@ -0,0 +1,37 @@
# $Id: g4py.gmk,v 1.2 2006/04/25 05:53:05 kmura Exp $
# ===========================================================
# Makefile for building Python module with Boost.Python
#
# ===========================================================
COMPILE_G4PY := true
G4PY_INCFLAGS := -I$(Q_G4_INCDIR)
G4PY_LOPT := -L$(Q_G4_LIBDIR) \
-lG4readout \
-lG4run \
-lG4event \
-lG4tracking \
-lG4parmodels \
-lG4processes \
-lG4digits_hits \
-lG4track \
-lG4particles \
-lG4geometry \
-lG4materials \
-lG4graphics_reps \
-lG4intercoms \
-lG4interfaces \
-lG4global
include $(G4PY_INSTALL)/config/g4vis.gmk
G4PY_LOPT += $(G4PY_VISLIBS)
G4PY_INCFLAGS += -I$(Q_CLHEP_INCDIR)
G4PY_LOPT += -L$(Q_CLHEP_LIBDIR) -l$(Q_CLHEP_LIB)
# geant4 version
G4PY_INCFLAGS += -I$(G4PY_INSTALL)/source/version
# boost patch
G4PY_INCFLAGS += -I$(G4PY_INSTALL)/source/boost
+51
View File
@@ -0,0 +1,51 @@
# $Id: g4vis.gmk,v 1.2 2006/04/25 05:53:05 kmura Exp $
# ===========================================================
# Makefile for building Python module with Boost.Python
#
# ===========================================================
G4PY_VISLIBS :=
# Not needing external packages or libraries...
G4PY_VISLIBS += -lG4FR
G4PY_VISLIBS += -lG4visHepRep
G4PY_VISLIBS += -lG4RayTracer
G4PY_VISLIBS += -lG4VRML
G4PY_VISLIBS += -lG4Tree
ifeq ($(Q_ENABLE_OPENGLX), 1)
Q_ENABLE_OPENGL = 1
CPPFLAGS += -DG4VIS_USE_OPENGLX
endif
ifeq ($(Q_ENABLE_OPENGLXM), 1)
Q_ENABLE_OPENGL = 1
CPPFLAGS += -DG4VIS_USE_OPENGLXM
endif
ifeq ($(Q_ENABLE__OPENGLWIN32), 1)
Q_ENABLE_OPENGL = 1
CPPFLAGS += -DG4VIS_USE_OPENGLWIN32
endif
ifeq ($(Q_ENABLE_OPENGL), 1)
CPPFLAGS += -DG4VIS_USE_OPENGL
G4PY_VISLIBS += -lG4OpenGL
endif
ifeq ($(Q_ENABLE_RAYTRACERX), 1)
CPPFLAGS += -DG4VIS_USE_RAYTRACERX
endif
ifeq ($(Q_ENABLE_DAWN), 1)
CPPFLAGS += -DG4VIS_USE_DAWN
endif
ifeq ($(Q_ENABLE_VRML), 1)
CPPFLAGS += -DG4VIS_USE_VRML
endif
CPPFLAGS += -DG4VIS_USE
G4PY_VISLIBS += -lG4vis_management
G4PY_VISLIBS += -lG4modeling
+11
View File
@@ -0,0 +1,11 @@
# $Id: install.gmk,v 1.2 2006/04/25 05:53:05 kmura Exp $
# ===========================================================
# Script for installing modules
# ===========================================================
G4PY_LIBDIR := $(Q_LIBDIR)/Geant4
install: $(module_name)
@echo ... intall $(module_name) into $(G4PY_LIBDIR)
@if [ ! -d $(G4PY_LIBDIR) ]; then install -d $(G4PY_LIBDIR); fi
@install -m 755 $(module_name) $(G4PY_LIBDIR)
+51
View File
@@ -0,0 +1,51 @@
# $Id: module.gmk,v 1.2 2006/04/25 05:53:05 kmura Exp $
# ===========================================================
# Script for building a Boost-Python module
# ===========================================================
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
# include/lib directives started...
INCFLAGS := -I.
LOPT :=
ifdef G4PY_EXLIB_LIBNAME
ifdef G4PY_EXLIB_INCDIR
INCFLAGS += -I$(G4PY_EXLIB_INCDIR)
endif
ifdef G4PY_EXLIB_LIBNAME
LOPT += -L$(G4PY_EXLIB_LIBDIR) -l$(G4PY_EXLIB_LIBNAME)
endif
endif
# Python...
INCFLAGS += -I$(Q_PYTHON_INCDIR)
# Boost.Python...
ifneq ($(Q_BOOST_INCDIR), /usr/include)
INCFLAGS += -I$(Q_BOOST_INCDIR)
endif
ifneq ($(Q_BOOST_LIBDIR), /usr/lib)
ifneq ($(Q_BOOST_LIBDIR), /usr/lib64)
LOPT += -L$(Q_BOOST_LIBDIR)
endif
endif
LOPT += -l$(Q_BOOST_PYTHON_LIB)
# finished
CXXFLAGS += $(INCFLAGS)
ifdef COMPILE_G4PY
CXXFLAGS += $(G4PY_INCFLAGS)
# Geant4 version
ifdef Q_G4_VERSION
CXXFLAGS += -DG4VERSION_NUMBER=$(Q_G4_VERSION)
endif
LOPT += $(G4PY_LOPT)
endif
# ok, building...
include $(G4PY_INSTALL)/config/build.gmk
+16
View File
@@ -0,0 +1,16 @@
# $Id: mylib.gmk,v 1.2 2006/04/25 05:53:05 kmura Exp $
# ===========================================================
# Script for building my libray
# ===========================================================
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
# include/lib directives started...
INCFLAGS := -I.
LOPT :=
# finished
CXXFLAGS += $(INCFLAGS)
# ok, building...
include $(G4PY_INSTALL)/config/build.gmk
+16
View File
@@ -0,0 +1,16 @@
# $Id: site-install.gmk,v 1.4 2006/06/14 08:23:12 kmura Exp $
# ===========================================================
# Script for installing modules
# ===========================================================
ifndef PACKAGE
PACKAGE := .
endif
install_dir := $(Q_LIBDIR)/$(PACKAGE)
install: $(module_name)
@echo ... intall $(module_name) into $(install_dir)
@if [ ! -d $(install_dir) ]; then install -d $(install_dir); fi
@install -m 755 $(module_name) $(install_dir)
+91
View File
@@ -0,0 +1,91 @@
# $Id: linux.gmk,v 1.3 2006/06/27 06:40:13 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# System specific terms
# ===========================================================
# compile flags
CXX := g++ -m32
ifdef COMPILE_WITH_BOOST
CXXFLAGS := -fPIC -ftemplate-depth-255 -finline-functions -Wno-inline
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
else
CXXFLAGS := -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
CXXFLAFS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
CXXFLAGS += -fPIC
endif
ifdef COMPILE_G4PY
CXXFLAGS := -fPIC -ansi -pipe
CXXFLAGS += -ftemplate-depth-255 -finline-functions
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
endif
# extention of shared library
soext := so
# implicit rules
%.o: %.cc
ifdef CPPVERBOSE
$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
else
@echo Compiling $< ...
@$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
endif
%.pyc: %.py; python -c 'import py_compile; py_compile.compile( "$<" )'
%.pyo: %.py; python -O -c 'import py_compile; py_compile.compile( "$<" )'
# building a shared library
ifdef Q_BOOST_LIBDIR
rpath0 := $(Q_BOOST_LIBDIR)
endif
ifdef G4PY_EXLIB_LIBDIR
rpath1 := $(G4PY_EXLIB_LIBDIR)
endif
ifdef COMPILE_G4PY
#rpath2 := $(Q_G4_LIBDIR):$(Q_CLHEP_LIBDIR)
ifneq ($(Q_G4_LIBDIR), $(BOOST_LIBDIR))
rpath2 := $(Q_G4_LIBDIR)
endif
ifneq ($(Q_CLHEP_LIBDIR), $(Q_G4_LIBDIR))
rpath3 := :$(Q_CLHEP_LIBDIR)
endif
endif
rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3)
ifdef CPPVERBOSE
define build-library
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ \
$(foreach dir,$(SUBLIBS),$(dir)/*.o)
endef
else
define build-library
@echo Building a library $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ \
$(foreach dir,$(SUBLIBS),$(dir)/*.o)
endef
endif
ifdef CPPVERBOSE
define build-module
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT)
endef
else
define build-module
@echo Building a module $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT)
endef
endif
@@ -0,0 +1,91 @@
# $Id: linuxx8664gcc.gmk,v 1.3 2006/06/27 06:40:14 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# System specific terms
# ===========================================================
# compile flags
CXX := g++ -m64
ifdef COMPILE_WITH_BOOST
CXXFLAGS := -fPIC -ftemplate-depth-255 -finline-functions -Wno-inline
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
else
CXXFLAGS := -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
CXXFLAFS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
CXXFLAGS += -fPIC
endif
ifdef COMPILE_G4PY
CXXFLAGS := -fPIC -ansi -pipe
CXXFLAGS += -ftemplate-depth-255 -finline-functions
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
endif
# extention of shared library
soext := so
# implicit rules
%.o: %.cc
ifdef CPPVERBOSE
$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
else
@echo Compiling $< ...
@$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
endif
%.pyc: %.py; python -c 'import py_compile; py_compile.compile( "$<" )'
%.pyo: %.py; python -O -c 'import py_compile; py_compile.compile( "$<" )'
# building a shared library
ifdef Q_BOOST_LIBDIR
rpath0 := $(Q_BOOST_LIBDIR)
endif
ifdef G4PY_EXLIB_LIBDIR
rpath1 := $(G4PY_EXLIB_LIBDIR)
endif
ifdef COMPILE_G4PY
#rpath2 := $(Q_G4_LIBDIR):$(Q_CLHEP_LIBDIR)
ifneq ($(Q_G4_LIBDIR), $(BOOST_LIBDIR))
rpath2 := $(Q_G4_LIBDIR)
endif
ifneq ($(Q_CLHEP_LIBDIR), $(Q_G4_LIBDIR))
rpath3 := :$(Q_CLHEP_LIBDIR)
endif
endif
rpathflag := -Wl,-rpath,$(rpath0):$(rpath1):$(rpath2):$(rpath3)
ifdef CPPVERBOSE
define build-library
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ \
$(foreach dir,$(SUBLIBS),$(dir)/*.o)
endef
else
define build-library
@echo Building a library $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ \
$(foreach dir,$(SUBLIBS),$(dir)/*.o)
endef
endif
ifdef CPPVERBOSE
define build-module
$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT)
endef
else
define build-module
@echo Building a module $@ ...
@$(CXX) $(rpathflag) -Wl,-soname,$@ -shared -o $@ $(objects) $(LOPT)
endef
endif
+90
View File
@@ -0,0 +1,90 @@
# $Id: macosx.gmk,v 1.2 2006/04/25 05:50:05 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# System specific terms
# ===========================================================
# 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 += -DBOOST_PYTHON_DYNAMIC_LIB
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
endif
ifdef COMPILE_G4PY
CXXFLAGS := -fPIC -ansi -pipe
CXXFLAGS += -ftemplate-depth-256 -Wno-long-double
CXXFLAGS += -no-cpp-precomp -fno-inline -fcoalesce-templates
CXXFLAGS += -DBOOST_PYTHON_DYNAMIC_LIB
ifndef DEBUG
CXXFLAGS += -DNDEBUG
endif
endif
# extention of shared library
soext := so
# implicit rules
%.o: %.cc
ifdef CPPVERBOSE
$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
else
@echo Compiling $< ...
@$(CXX) -c -o $@ $(CXXFLAGS) $(CPPFLAGS) $*.cc
endif
%.pyc: %.py; python -c 'import py_compile; py_compile.compile( "$<" )'
%.pyo: %.py; python -O -c 'import py_compile; py_compile.compile( "$<" )'
# building a shared library
ifdef BOOST_LIBDIR
rpath0 := $(BOOST_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)
endef
else
define build-library
@echo Building a module $@ ...
@$(CXX) $(rpathflag) -bundle -flat_namespace -undefined define_a_way \
-o $@ $(foreach dir,$(SUBLIBS),$(dir)/*.o)
endef
endif
ifdef CPPVERBOSE
define build-module
$(CXX) $(rpathflag) -bundle -flat_namespace -undefined define_a_way \
-o $@ $(objects) $(LOPT)
endef
else
define build-module
@echo Building a module $@ ...
@$(CXX) $(rpathflag) -bundle -flat_namespace -undefined define_a_way \
-o $@ $(objects) $(LOPT)
endef
endif
Vendored Executable
+408
View File
@@ -0,0 +1,408 @@
#! /bin/sh -
#$Id: configure,v 1.3 2006/06/20 09:35:06 kmura Exp $
# ======================================================================
# A configure script for Geant4Py
# ======================================================================
export LANG=C
IFS='
'
PATH=/bin:/usr/bin
export PATH
# ======================================================================
# help message
# ======================================================================
show_help() {
cat <<EOF
\`configure' configures Geant4Py to adapt to many kinds of systems.
Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]...
SYSTEM: System type (see Supported Arhitectures)
Options:
-h, --help Display this help and exit
Installation directories:
--prefix=PREFIX Installation prefix [./]
--libdir=DIR Python modules installaion dir [PREFIX/lib]
--incdir=DIR Header installaion dir [PREFIX/include]
Fine tuning of the library path:
--with-g4-incdir=DIR Geant4 header dir [\$G4INCLUDE]
--with-g4-libdir=DIR Geant4 library dir [\$G4LIB/\$G4SYSTEM]
--with-g4-version=NUM Geant4 version (700/701/710/711)
Not required after ver.8.0
--with-clhep-incdir=DIR CLHEP header dir [\$CLHEP_INCLUDE_DIR]
--with-clhep-libdir=DIR CLHEP library dir [\$CLHEP_LIB_DIR]
--with-clhep-lib=LIB library name of libCLHEP.so [CLHEP|\$CLHEP_LIB]
--with-python-incdir=DIR Python header dir [/usr/include/python],
(location of pyconfig.h)
--with-python-libdir=DIR Python library dir [/usr/lib]
--with-boost-incdir=DIR BOOST-C++ header dir [/usr/include],
(location of boost/)
--with-boost-libdir=DIR BOOST-C++ library dir [/usr/lib]
--with-boost-python-lib=LIB library name of libboost_python.so [boost_python]
--with-package-dir=DIR Geant4 Package dir
Enable/disable options: prefix with either --enable- or --disable-
openglx OpenGLX support [auto]
openglxm OpenGLXm support [disable, \$G4VIS_USE_OPENGLXM]
raytracerx RayTracerX support [disable, \$G4VIS_USE_RAYTRACERX]
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)
EOF
}
# ======================================================================
# main
# ======================================================================
# input
arguments="$@"
# default values
prefix=`pwd`
current_dir=`pwd`
g4_incdir=${G4INCLUDE:-/zzz}
g4_libdir=${G4LIB:+$G4LIB/$G4SYSTEM}
g4_libdir=${g4_libdir:-/zzz}
g4_version=${G4VERSION_NUMBER:-auto}
clhep_incdir=${CLHEP_INCLUDE_DIR:-/zzz}
clhep_libdir=${CLHEP_LIB_DIR:-/zzz}
clhep_lib=${CLHEP_LIB:-CLHEP}
python_incdir=/usr/include/python
boost_incdir=/usr/include
boost_python_lib=boost_python
enable_openglx=1
enable_openglxm=${G4VIS_USE_OPENGLXM:+1}
enable_openglxm=${enable_openglxm:-0}
enable_raytracerx=${G4VIS_USE_RAYTRACERX:+1}
enable_raytracerx=${enable_raytracerx:-0}
# checking system
case $1 in
linux|linuxx8664gcc|macosx)
system=$1
echo -n "Checking for system type ... "
if [ ! -e "config/sys/$system.gmk" ]; then
echo "no"
echo -n "### Invalid system type. "
echo "Please taka a look in config/sys/."
exit -1
fi
echo "$system"
;;
--help|-h)
show_help
exit 0
;;
*)
echo "Error: System type is not specified or more than one system type. "
echo ""
echo "Usage: ./configure SYSTEM [OPTION]... [VAR=VALUE]..."
echo ""
exit -1
;;
esac
shift
# parsing options
while test $# -gt 0
do
case $1 in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--help|-h) show_help; exit 0 ;;
# ---------------------------------------------------------------
--prefix=*) prefix=$optarg ;;
--libdir=*) libdir=$optarg ;;
--with-package-dir=*) g4_incdir=$optarg/include/Geant4
g4_libdir=$optarg/lib
clhep_incdir=$optarg/include
clhep_libdir=$optarg/lib ;;
--with-g4-incdir=*) g4_incdir=$optarg ;;
--with-g4-libdir=*) g4_libdir=$optarg ;;
--with-g4-version=*) g4_version=$optarg ;;
--with-clhep-incdir=*) clhep_incdir=$optarg ;;
--with-clhep-libdir=*) clhep_libdir=$optarg ;;
--with-clhep-lib=*) clhep_lib=$optarg ;;
--with-python-incdir=*) python_incdir=$optarg ;;
--with-python-libdir=*) python_libdir=$optarg ;;
--with-boost-incdir=*) boost_incdir=$optarg ;;
--with-boost-libdir=*) boost_libdir=$optarg ;;
--with-boost-python-lib=*) boost_python_lib=$optarg ;;
# ---------------------------------------------------------------
--enable-openglx ) enable_openglx=1 ;;
--disable-openglx ) enable_openglx=0 ;;
--enable-openglxm ) enable_openglxm=1 ;;
--disable-openglxm ) enable_openglxm=0 ;;
--enable-raytracerx ) enable_raytracerx=1 ;;
--disable-raytracerx ) enable_raytracerx=0 ;;
# ---------------------------------------------------------------
-*)
echo "Unrecognized option: $1"
exit -1
;;
*)
echo "Invalid argument: $1"
exit -1
;;
esac
shift
done
# check variables
arch=32
if [ $system == linuxx8664gcc ]; then
arch=64
fi
echo -n "Checking for prefix ... "
echo $prefix
echo -n "Checking for lib dir ... "
libdir=${libdir:-$prefix/lib}
echo $libdir
echo -n "Checking for include dir ... "
incdir=${incdir:-$prefix/include}
echo $libdir
echo -n "Checking for G4 include dir ... "
if [ ! -d "$g4_incdir" ]; then
echo "no"
echo -n "### $g4_incdir (g4-incdir) does not exist. "
echo "Try --with-g4-incdir option."
exit -1
fi
echo "$g4_incdir"
echo -n "Checking for G4 lib dir ... "
if [ ! -d "$g4_libdir" ]; then
echo "no"
echo -n "### $g4_libdir (g4-libdir) does not exist. "
echo "Try --with-g4-libdir option."
exit -1
fi
echo "$g4_libdir"
echo -n "Checking for G4 version ... "
case $g4_version in
auto|700|701|710|711)
echo "$g4_version"
;;
*)
echo "no"
echo "### $g4_version (g4-version) is invalid (700/701/710/711)."
exit -1
;;
esac
if [ "$g4_version" = "auto" ]; then
if [ ! -f "$g4_incdir"/G4Version.hh ]; then
echo "### G4Version.hh does not exist. Try --with-g4-version option."
exit -1
fi
fi
# ---
echo -n "Checking for CLHEP include dir ... "
if [ ! -d "$clhep_incdir" ]; then
echo "no"
echo -n "### $clhep_incdir (clhep-incdir) does not exist. "
echo "Try --with-clhep-incdir option."
exit -1
fi
echo "$clhep_incdir"
echo -n "Checking for CLHEP lib dir ... "
if [ ! -d "$clhep_libdir" ]; then
echo "no"
echo -n "### $clhep_libdir (clhep-libdir) does not exist. "
echo "Try --with-clhep-libdir option."
exit -1
fi
echo "$clhep_libdir"
echo -n "Checking for CLHEP lib name ... "
if [ ! -f "$clhep_libdir"/lib${clhep_lib}.so ]; then
echo "no"
echo -n "### lib${clhep_lib}.so (clhep-lib) does not exist. "
echo "Try --with-clhep-lib option."
exit -1
fi
echo "lib${clhep_lib}.so"
# ---
echo -n "Checking for Python include dir (pyconfig.h) ... "
if [ ! -f "$python_incdir"/pyconfig.h ]; then
echo "no"
echo -n "### $python_incdir (python-incdir) is invalid. "
echo "Try --with-python-incdir option."
exit -1
fi
echo "$python_incdir"
echo -n "Checking for Python lib dir ... "
if [ ! $python_libdir ]; then
if [ $arch == 64 ]; then
python_libdir=/usr/lib64
else
python_libdir=/usr/lib
fi
fi
if [ ! -d "$python_libdir" ]; then
echo "no"
echo -n "### $python_libdir (python-libdir) does not exist. "
echo "Try --with-python-libdir option."
exit -1
fi
echo "$python_libdir"
# ---
echo -n "Checking for Boost include dir (boost/python.hpp) ... "
if [ ! -f "$boost_incdir"/boost/python.hpp ]; then
echo "no"
echo -n "### $boost_incdir (boost-incdir) is invalid. "
echo "Try --with-boost-incdir option."
exit -1
fi
echo "$boost_incdir"
echo -n "Checking for Boost lib dir ... "
if [ ! $boost_libdir ]; then
if [ $arch == 64 ]; then
boost_libdir=/usr/lib64
else
boost_libdir=/usr/lib
fi
fi
if [ ! -d "$boost_libdir" ]; then
echo "no"
echo -n "### $boost_libdir (boost-libdir) does not exist. "
echo "Try --with-boost-libdir option."
exit -1
fi
echo "$boost_libdir"
echo -n "Checking for Boost Python lib name ... "
if [ ! -f "$boost_libdir"/lib${boost_python_lib}.so ]; then
echo "no"
echo -n "### lib${boost_python_lib}.so (boost-python-lib) does not exist. "
echo "Try --with-boost-libdir option."
exit -1
fi
echo "lib${boost_python_lib}.so"
# ---
echo -n "Checking for OpenGL support ..."
if [ -f "$g4_libdir"/libG4OpenGL.so ]; then
if [ $enable_openglx == 0 ]; then
echo "disabled"
else
echo "yes"
fi
else
echo "no"
enable_openglx=0
fi
# ---
echo -n "Writing config.gmk ... "
make_config=config/config.gmk
cat > $make_config <<EOF
# config.gmk
#
# Automatically generated by configure script
#
# Makefile definitions included by the top Makefile
G4PY_INSTALL := $current_dir
Q_SYSTEM := $system
Q_PREFIX := $prefix
Q_LIBDIR := $libdir
Q_INCDIR := $incdir
Q_G4_INCDIR := $g4_incdir
Q_G4_LIBDIR := $g4_libdir
EOF
if [ $g4_version != auto ]; then
cat >> $make_config <<EOF
Q_G4_VERSION := $g4_version
EOF
fi
cat >> $make_config <<EOF
Q_CLHEP_INCDIR := $clhep_incdir
Q_CLHEP_LIBDIR := $clhep_libdir
Q_CLHEP_LIB := $clhep_lib
Q_PYTHON_INCDIR := $python_incdir
Q_PYTHON_LIBDIR := $python_libdir
Q_BOOST_INCDIR := $boost_incdir
Q_BOOST_LIBDIR := $boost_libdir
Q_BOOST_PYTHON_LIB := $boost_python_lib
Q_ENABLE_OPENGLX := $enable_openglx
Q_ENABLE_OPENGLXM := $enable_openglxm
Q_ENABLE_RAYTRACERX := $enable_raytracerx
EOF
echo "done"
echo -n "Writing config.status ... "
echo $arguments > config.status
echo "done"
# ---
echo ""
echo -n "Enabled support for"
if [ $enable_openglx = 1 ]; then
echo -n " openglx"
fi
if [ $enable_openglxm = 1 ]; then
echo -n " openglxm"
fi
if [ $enable_raytracerx = 1 ]; then
echo -n " raytracerx"
fi
echo "."
# ---
echo ""
echo "To build Geant4Py type:"
echo ""
echo " make"
echo " make install"
echo ""
exit 0
+32
View File
@@ -0,0 +1,32 @@
$Id: History,v 1.2 2006/06/13 15:53:08 kmura Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
A set of examples for Geant4Py.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14 June 2006 K.Murakami
- Summary
[demos/water_phantom]
an example of dose calculation in water phantom with
on-line histogramming with ROOT
[education/lesson1, lesson2]
educational examples with TKinter GUI
[emplot]
examples of plotting photon cross section and stopping power
24 June 2005 K.Murakami
- just created.
+258
View File
@@ -0,0 +1,258 @@
\documentclass{article}
\title{How to EZsim using the site-modules of Geant4Py?}
\author{ H. Yoshida \and K. Murakami}
\begin{document}
\maketitle
\section{g4py/site-modules}
Currently site-modules have the following wrapper modules:
\begin{itemize}
\item EZsim
\begin{itemize}
\item EZgeom : main topic of this document
\begin{itemize}
\item ezgeom
\end{itemize}
\end{itemize}
\item geometries : examples of wrapping
\begin{itemize}
\item ExN01geom
\item ExN03geom
\end{itemize}
\item materials : pre-defined materials
\begin{itemize}
\item NISTmaterials
\end{itemize}
\item physics\_lists : examples of wrapping
\begin{itemize}
\item EMSTDpl
\item ExN01pl
\item ExN03pl
\item (GenericPhysicsList)
\end{itemize}
\item primaries : pre-defined particle guns
\begin{itemize}
\item MedicalBeam
\item ParticleGun
\end{itemize}
\end{itemize}
\section{The levels of Python wrapping}
The application of these site modules are stored in
\begin{itemize}
\item tests : many test examples
\item examples/demos/water\_phantom : voxelized water phantom and scoring
\item examples/education
\begin{itemize}
\item lesson1 : measurement of the mass attenuation coefficients
\item lesson2 : exampleN03
\end{itemize}
\end{itemize}
In general, Python wrapping can be applied in various levels.
This can be seen, for example, in the above examples which demonstrate how the
geometries are constructed. We cite two examples how site modules can be used,
and how existing C++ classes can be wrapped to co-work within the framework of
Geant4Py.
\subsection{Full Python case}
The script examples/education/lesson1/Lesson1.py uses the Phtyon modules of
EZgeom. It defines a simple absorber box, using EZgeom module. Its material,
dimensions, colors etc. are modifiable by using Python methods.
\subsection{Wrapping an existing C++ geometry}
The script examples/education/lesson2/ExN03.py uses the geometry of
exampleN03 as it is (ExN03DetectorConstruction).
The modules in site-modules/geometries/ExN03geom wrap these C++ classes and
their methods like exposes its methods like "SetAbsorberMaterial",
"SetAbsorberThickness", "GeometryUpdated" etc..
It also used wrapped "ExN03PhysicsList".
So, ExN03.py script do nothing for the geometry and physics list. It simply
initialized them.
\section{Closer look: Full Python case}
Exposed modules by the EZgeom module are following:
\begin{itemize}
\item Construct() :
\item SetWorldMaterial(material)
\item SetWorldVisibility(bool)
\item ResizeWorld(dx, dy, dz)
\item ResetWorld(dx, dy, dz)
\end{itemize}
Also exposed are modules in the G4EzVolume class.
\begin{itemize}
\item CreateBoxVolume, Tube/Cone/Sphere/Orb
\item Set(Get)Sold
\item Set(Get)Material
\item Set(Get)Color
\item Set(Get)Visibility
\item
\item Placeit()
\item ReplicateIt()
\item VoxelizeIt()
\item
\item SetSensitiveDetector
\end{itemize}
In addition, you can use global names like gMaterialTable etc. which are
defined in the g4py/source and exposed in the widest name space under
Boost-python. You can easily get the list of all g* modules from ipython
shell, once you import Geant4 modules.
Let us explain how to use the above modules, taking the script in
examples/education/lesson1/Leson1.py as an example.
It starts by lines to import modules:
\begin{verbatim}
1: from Geant4 import *
2: import NISTmaterials
3: from EZsim import EZgeom
4: from EZsim.EZgeom import G4EzVolume
5: import EMSTDpl
6: import ParticleGun
7: from time import *
8: import sys
\end{verbatim}
In line 1 you import all exposed modules of Geant4.
From the line 2 to 6, you import relevant site-modules. Lines 7 and 8 is to
import generic Python modules.
Then you define a Python class "Configure" for initialization.
\begin{verbatim}
def Configure():
NISTmaterials.Construct() # NIST materials predefined in g4py
EZgeom.Construct() # initialize
EMSTDpl.Construct() # initialize the physics list
ParticleGun.Construct() # initialize the particle gun
gControlExecute("gun.mac") # this is one of the globals
\end{verbatim}
Now you define the concrete geometry.
\begin{verbatim}
def ConstructGeom():
print "* Constructing geometry..."
# materils
galactic = G4Material.GetMaterial("G4_Galactic", 1)
water = G4Material.GetMaterial("G4_WATER", 1)
# world
EZgeom.SetWorldMaterial(galactic)
EZgeom.ResizeWorld(120.*cm, 120.*cm, 100.*cm)
# water phantom ; logical and physical volumes
global water_phantom, water_phantom_pv
water_phantom= G4EzVolume("WaterPhantom")
water_phantom.CreateBoxVolume(water, 110.*cm, 110.*cm, 10.*cm)
#Place the water phantom in the vacuum!!
water_phantom_pv = water_phantom.PlaceIt(G4ThreeVector(0.,0.,0.*cm))
\end{verbatim}
Here water\_phantom is the logical volume, while water\_phantom\_pv is the
physical volume. These variables are defined as global for later use.
If you want to change the material of the water\_phantom with the lead, for
example, you define lead by makinging its instance from the pre-defined list
and SetMaterial().
\begin{verbatim}
lead = G4Material.GetMaterial("G4_Pb", 1)
water_phantom.SetMaterial(lead)
\end{verbatim}
To print out the name of the materialof the logical volume,
\begin{verbatim}
print water_phantom.Getmaterial().GetName()
\end{verbatim}
If you want to change the dimensions of the water\_phantom, you have to get
its instance of the solid, and then SetZHalfLength().
\begin{verbatim}
solid = EZgeom.G4EzVolume.GetSold(water_phantom)
solid.SetZHalfLength(thickness * mm/2.0)
\end{verbatim}
If you want to relocate the water phantom, i.e., water\_phantom\_pv,
\begin{verbatim}
water_phantom_pv.SetTransformation(G4TreeVector(, ,))
\end{verbatim}
You can use any Geant4 commands with gApplyUICommand() method.
You simply provide it with strings, as seen in the next code fragment.
\begin{verbatim}
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)
\end{verbatim}
With the above code fragment, you use "eventVar" which is supplied by the
"Scale" widget. You repeat gRunManager.BeamOn(1), after a sleep of every
o.o1 second. You use gApplyUICommand() to change the gun's YZ position before
every shoot.
\section{Closer study: wrapped C++ classes case}
The script file in g4py/examples/education/lesson2/ExN03.py is an example.
The C++ classes of geometry and physics list of exampleN03 are exposed with
mo modifications. To expose them, wrapper classes, pyExN03geom.cc and
pyExN03pl.cc are created and stored in ExN03geom/ and ExN03pl/ respectively.
They are pre-compiled and shared libraries; ExN03geom.so, and ExN03pl.so are
stored in the g4py/lib/site-modules library repository.
ExN03geom exposes all the methods defined in ExN03DetectorConstruction.
ExN03.py in lesson2 initializes the geometry and physics list by simply using
the exposed classes;
\begin{verbatim}
from Geant4 import *
import NISTmaterials
import ExN03geom
import ExN03pl
exN03geom = ExN03geom.ExN03DetectorConstruction()
gRunManager.SetUserInitialization(exN03geom)
exN03PL = ExN03pl.ExN03PhysicsList()
gRunManager.SetUserInitialization(exN03PL)
\end{verbatim}
ExN03.py provides the widgets to choose a material with the Checkbutton,
to set the thickness with the Scale widget etc. It provides a "Run" button
to do /run/beamOn equivalent.
Just before "beamOn", the geometry is modified like;
\begin{verbatim}
def cmd_beamOn(self):
exN03geom.SetAbsorberMaterial(self.materialVar.get())
exN03geom.SetAbsorberThickness(self.thickVar.get() * mm/2.0)
exN03geom.UpdateGeometry()
exN03PL.SetDefaultCutValue(self.cutVar.get() * mm)
exN03PL.SetCutsWithDefault()
exN03geom.SetMagField(self.magVar.get() * tesla)
\end{verbatim}
Here, self.xxxVar.get() are the values (String or Double) supplied by the
Checkbutton or Scale widgets.
The on/off of each process is done using the global name gProcessTable.
\begin{verbatim}
def cmd_setProcess(self):
for i in self.processList:
if self.processVar[i].get() == 0:
gProcessTable.SetProcessActivation(i, 0)
print "Process " + i + " inactivated"
else:
gProcessTable.SetProcessActivation(i, 1)
print "Process " + i + " activated"
\end{verbatim}
Here "processList" is a list of the names of processes like below and
"processVar" contains the on/off values of the Checkbuttons for respective
processes.
\begin{verbatim}
self.processList = ["phot", "compt", "conv", "msc", "eIoni", "eBrem", "annih
il","muIoni", "muBrems"]
\end{verbatim}
\end{document}
+31
View File
@@ -0,0 +1,31 @@
$Id: README,v 1.2 2006/06/13 16:07:20 kmura Exp $
-------------------------------------------------------------------
This directory contains a set of examples for Geant4Py.
[demos/water_phantom]
An example of "water phantom dosimetry"
This demo program shows that a Geant4 application well coworks with ROOT
on Python front end. VisManager, PrimaryGeneratorAction, UserAction-s,
histogramming with ROOT are implemented in Python;
+ dose calculation in a water phantom
+ Python overloading of user actions
+ on-line histogramming with ROOT
+ visualization
[education]
Educational examples with Graphical User Interface using TKinter
* lesson1
The first version of the courseware of the mass attenuation coefficient.
* lesson2
GUI interface of ExN03, which can control geometry configuration,
intial particle condition, physics processes, cut value,
magnetic field and visualization outputs.
[emplot]
Examples of plotting photon cross sections and stopping powers with ROOT
+216
View File
@@ -0,0 +1,216 @@
#!/usr/bin/python
# ==================================================================
# python script for Geant4Py test
#
# gtest01
# - check basic control flow
# ==================================================================
from Geant4 import *
import demo_wp
import MedicalBeam
import ROOT
# ==================================================================
# ROOT PART #
# ==================================================================
# ------------------------------------------------------------------
def init_root():
# ------------------------------------------------------------------
ROOT.gROOT.Reset()
# plot style
ROOT.gStyle.SetTextFont(42)
ROOT.gStyle.SetTitleFont(42, "X")
ROOT.gStyle.SetLabelFont(42, "X")
ROOT.gStyle.SetTitleFont(42, "Y")
ROOT.gStyle.SetLabelFont(42, "Y")
global gCanvas
gCanvas= ROOT.TCanvas("water_phantom_plots",
"Water Phantom Demo Plots",
620, 30, 800, 800)
# ------------------------------------------------------------------
def hini():
# ------------------------------------------------------------------
global gPad1
gPad1= ROOT.TPad("2D", "2D", 0.02, 0.5, 0.98, 1.)
gPad1.Draw()
gPad1.cd()
ROOT.gStyle.SetPalette(1);
global hist_dose2d
hist_dose2d= ROOT.TH2D("2D Dose", "Dose Distribution",
200, 0., 400.,
81, -81., 81.)
hist_dose2d.SetXTitle("Z (mm)")
hist_dose2d.SetYTitle("X (mm)")
hist_dose2d.SetStats(0)
hist_dose2d.Draw("colz")
gCanvas.cd()
global gPad2
gPad2= ROOT.TPad("Z", "Z", 0.02, 0., 0.98, 0.5)
gPad2.Draw()
gPad2.cd()
global hist_dosez
hist_dosez= ROOT.TH1D("Z Dose", "Depth Dose", 200, 0., 400.)
hist_dosez.SetXTitle("(mm)")
hist_dosez.SetYTitle("Accumulated Dose (MeV)")
hist_dosez.Draw()
# ------------------------------------------------------------------
def hshow():
# ------------------------------------------------------------------
gPad1.cd()
hist_dose2d.Draw("colz")
gPad2.cd()
hist_dosez.Draw()
# ==================================================================
# Geant4 PART #
# ==================================================================
# ==================================================================
# user actions in python
# ==================================================================
class MyPrimaryGeneratorAction(G4VUserPrimaryGeneratorAction):
"My Primary Generator Action"
def __init__(self):
G4VUserPrimaryGeneratorAction.__init__(self)
self.particleGun= G4ParticleGun(1)
def GeneratePrimaries(self, event):
self.particleGun.GeneratePrimaryVertex(event)
# ------------------------------------------------------------------
class MyRunAction(G4UserRunAction):
"My Run Action"
def EndOfRunAction(self, run):
print "*** End of Run"
print "- Run sammary : (id= %d, #events= %d)" \
% (run.GetRunID(), run.GetNumberOfEventToBeProcessed())
# ------------------------------------------------------------------
class MyEventAction(G4UserEventAction):
"My Event Action"
def EndOfEventAction(self, event):
gPad1.Modified()
gPad1.Update()
gPad2.Modified()
gPad2.Update()
ROOT.gSystem.ProcessEvents()
# ------------------------------------------------------------------
class MySteppingAction(G4UserSteppingAction):
"My Stepping Action"
def UserSteppingAction(self, step):
pass
# ------------------------------------------------------------------
class ScoreSD(G4VSensitiveDetector):
"SD for score voxels"
def __init__(self):
G4VSensitiveDetector.__init__(self, "ScoreVoxel")
def ProcessHits(self, step, rohist):
preStepPoint= step.GetPreStepPoint()
if(preStepPoint.GetCharge() == 0):
return
track= step.GetTrack()
touchable= track.GetTouchable()
voxel_id= touchable.GetReplicaNumber()
dedx= step.GetTotalEnergyDeposit()
xz= posXZ(voxel_id)
hist_dose2d.Fill(xz[1], xz[0], dedx/MeV)
if( abs(xz[0]) <= 100 ):
hist_dosez.Fill(xz[1], dedx/MeV)
# ------------------------------------------------------------------
def posXZ(copyN):
dd= 2.*mm
nx= 81
iz= copyN/nx
ix= copyN-iz*nx-nx/2
x0= ix*dd
z0= (iz+0.5)*dd
return (x0,z0)
# ==================================================================
# main
# ==================================================================
# init ROOT...
init_root()
hini()
# configure application
#app= demo_wp.MyApplication()
#app.Configure()
myMaterials= demo_wp.MyMaterials()
myMaterials.Construct()
myDC= demo_wp.MyDetectorConstruction()
gRunManager.SetUserInitialization(myDC)
myPL= demo_wp.MyPhysicsList()
gRunManager.SetUserInitialization(myPL)
# set user actions...
myPGA= MyPrimaryGeneratorAction()
gRunManager.SetUserAction(myPGA)
myRA= MyRunAction()
gRunManager.SetUserAction(myRA)
myEA= MyEventAction()
gRunManager.SetUserAction(myEA)
#mySA= MySteppingAction()
#gRunManager.SetUserAction(mySA)
# set particle gun
#pg= myPGA.particleGun
#pg.SetParticleByName("proton")
#pg.SetParticleEnergy(230.*MeV)
#pg.SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.))
#pg.SetParticlePosition(G4ThreeVector(0.,0.,-50.)*cm)
# medical beam
beam= MedicalBeam.Construct()
beam.particle= "proton"
beam.kineticE= 230.*MeV
#beam.particle= "gamma"
#beam.kineticE= 1.77*MeV
beam.sourcePosition= G4ThreeVector(0.,0.,-100.*cm)
beam.SSD= 100.*cm
beam.fieldXY= [5.*cm, 5.*cm]
# initialize
gRunManager.Initialize()
# set SD (A SD should be set after geometry construction)
scoreSD= ScoreSD()
myDC.SetSDtoScoreVoxel(scoreSD)
# visualization
gApplyUICommand("/control/execute vis.mac")
# beamOn
gRunManager.BeamOn(100)
#ROOT.gSystem.Run()
@@ -0,0 +1,14 @@
# $Id: GNUmakefile,v 1.1 2006/05/11 04:35:32 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../../config/config.gmk
# python module name
MODULE := ../demo_wp#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
@@ -0,0 +1,137 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MyDetectorConstruction.cc,v 1.3 2006/06/29 15:28:11 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyDetectorConstruction.cc
//
// 2005 Q
// ====================================================================
#include "MyDetectorConstruction.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
// ====================================================================
//
// class description
//
// ====================================================================
////////////////////////////////////////////////
MyDetectorConstruction::MyDetectorConstruction()
: scoreVoxel(0)
////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////
MyDetectorConstruction::~MyDetectorConstruction()
/////////////////////////////////////////////////
{
}
//////////////////////////////////////////////////////
G4VPhysicalVolume* MyDetectorConstruction::Construct()
//////////////////////////////////////////////////////
{
G4Material* mate;
G4VisAttributes* va;
// ==============================================================
// world volume
// ==============================================================
G4Box* areaSolid= new G4Box("area", 25.*cm, 25.*cm, 1.1*m);
G4Material* vacuum= G4Material::GetMaterial("Vacuum");
G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "area");
G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "area",
areaLV, 0, false, 0);
// vis. attributes
va= new G4VisAttributes(G4Color(1.,1.,1.));
va-> SetVisibility(false);
areaLV-> SetVisAttributes(va);
// ==============================================================
// phantom
// ==============================================================
// water phantom
const double dxyphantom= 40.*cm;
const double dzphantom= 50.*cm;
G4Box* sphantom= new G4Box("phantom",
dxyphantom/2., dxyphantom/2., dzphantom/2.);
G4Material* water= G4Material::GetMaterial("Water");
G4LogicalVolume* lphantom= new G4LogicalVolume(sphantom,
water, "phantom");
G4PVPlacement* phantom= new G4PVPlacement(0,
G4ThreeVector(0.,0., dzphantom/2.),
lphantom, "phantom",
areaLV, false, 0);
va= new G4VisAttributes(G4Color(0.,0.1,0.8));
lphantom-> SetVisAttributes(va);
// score voxels
const G4double dvoxel= 2.*mm;
const G4double dvoxel_y= 20.*mm;
G4Box* svoxel= new G4Box("voxel", dvoxel/2., dvoxel_y/2., dvoxel/2.);
scoreVoxel= new G4LogicalVolume(svoxel, water, "voxel");
va= new G4VisAttributes(G4Color(0.,0.8,0.8));
va-> SetVisibility(false);
scoreVoxel-> SetVisAttributes(va);
G4int ix, iz;
G4int index=0;
for (iz=0; iz<200; iz++) {
for (ix=-40; ix<=40; ix++) {
G4double x0= ix*dvoxel;
G4double z0= -dzphantom/2.+(iz+0.5)*dvoxel;
G4PVPlacement* pvoxel= new
G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
scoreVoxel, "voxel", lphantom,
false, index);
index++;
}
}
return area;
}
/////////////////////////////////////////////////////////////////////////
void MyDetectorConstruction::SetSDtoScoreVoxel(G4VSensitiveDetector* asd)
/////////////////////////////////////////////////////////////////////////
{
if(scoreVoxel) {
scoreVoxel-> SetSensitiveDetector(asd);
}
}
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * 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: MyDetectorConstruction.hh,v 1.3 2006/06/29 15:28:13 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyDetectorConstruction.hh
//
// 2005 Q
// ====================================================================
#ifndef MY_DETECTOR_CONSTRUCTION_H
#define MY_DETECTOR_CONSTRUCTION_H
#include "G4VUserDetectorConstruction.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4LogicalVolume;
class G4VSensitiveDetector;
class MyDetectorConstruction : public G4VUserDetectorConstruction {
private:
G4LogicalVolume* scoreVoxel;
public:
MyDetectorConstruction();
~MyDetectorConstruction();
virtual G4VPhysicalVolume* Construct();
void SetSDtoScoreVoxel(G4VSensitiveDetector* asd);
};
#endif
@@ -0,0 +1,121 @@
//
// ********************************************************************
// * 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: MyMaterials.cc,v 1.3 2006/06/29 15:28:16 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyMaterials.cc
//
// 2005 Q
// ====================================================================
#include "MyMaterials.hh"
#include "G4Material.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////
MyMaterials::MyMaterials()
//////////////////////////
{
}
///////////////////////////
MyMaterials::~MyMaterials()
///////////////////////////
{
}
/////////////////////////////
void MyMaterials::Construct()
/////////////////////////////
{
G4double A, Z;
// ------------------------------------------------------------------------
// Elements
// ------------------------------------------------------------------------
G4Element* elH = new G4Element("Hydrogen","H", Z=1., A=1.00794*g/mole);
G4Element* elC = new G4Element("Carbon", "C", Z=6., A= 12.011 *g/mole);
G4Element* elN = new G4Element("Nitrogen","N", Z=7., A= 14.00674*g/mole);
G4Element* elO = new G4Element("Oxygen", "O", Z=8., A= 15.9994*g/mole);
// ------------------------------------------------------------------------
// Materials
// ------------------------------------------------------------------------
G4double density, massfraction;
G4int natoms, nel;
// temperature of experimental hall is controlled at 20 degree.
const G4double expTemp= STP_Temperature+20.*kelvin;
// vacuum
density= universe_mean_density;
G4Material* Vacuum= new G4Material("Vacuum", density, nel=2);
Vacuum-> AddElement(elN, .7);
Vacuum-> AddElement(elO, .3);
// air
density= 1.2929e-03 *g/cm3; // at 20 degree
G4Material* Air= new G4Material("Air", density, nel=2,
kStateGas, expTemp);
G4double ttt= 75.47+23.20;
Air-> AddElement(elN, massfraction= 75.47/ttt);
Air-> AddElement(elO, massfraction= 23.20/ttt);
// water
density= 1.000*g/cm3;
G4Material* H2O= new G4Material("Water", density, nel=2);
H2O-> AddElement(elH, natoms=2);
H2O-> AddElement(elO, natoms=1);
// alminium
A= 26.98 *g/mole;
density= 2.70 *g/cm3;
G4Material* Al= new G4Material("Al", Z=13., A, density);
// iron
A= 55.847 *g/mole;
density= 7.87 *g/cm3;
G4Material* Fe= new G4Material("Iron", Z=26., A, density);
// lead
A= 207.2 *g/mole;
density= 11.35 *g/cm3;
G4Material* Pb= new G4Material("Lead", Z=82., A, density);
// scintillator (Polystyene(C6H5CH=CH2))
density= 1.032 *g/cm3;
G4Material* Scinti= new G4Material("Scinti", density, nel=2);
Scinti-> AddElement(elC, natoms=8);
Scinti-> AddElement(elH, natoms=8);
}
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MyMaterials.hh,v 1.3 2006/06/29 15:28:19 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyMaterials.hh
//
// 2005 Q
// ====================================================================
#ifndef MY_MATERIALS_H
#define MY_MATERIALS_H
#include "globals.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class MyMaterials {
public:
MyMaterials();
~MyMaterials();
void Construct();
};
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MyPhysicsList.cc,v 1.3 2006/06/29 15:28:21 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyPhysicsList.cc
//
// 2005 Q
// ====================================================================
#include "MyPhysicsList.hh"
#include "Particles.hh"
#include "PhysicsListEMstd.hh"
#include "PhysicsListLHad.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////
MyPhysicsList::MyPhysicsList()
: G4VModularPhysicsList()
//////////////////////////////
{
defaultCutValue = 1.*mm;
SetVerboseLevel(1);
RegisterPhysics(new Particles);
RegisterPhysics(new PhysicsListEMstd);
RegisterPhysics(new PhysicsListLHad);
}
///////////////////////////////
MyPhysicsList::~MyPhysicsList()
///////////////////////////////
{
}
/////////////////////////////
void MyPhysicsList::SetCuts()
/////////////////////////////
{
SetCutsWithDefault();
}
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: MyPhysicsList.hh,v 1.3 2006/06/29 15:28:23 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyPhysicsList.hh
//
// 2005 Q
// ====================================================================
#ifndef MY_PHYSICS_LIST_H
#define MY_PHYSICS_LIST_H
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class MyPhysicsList: public G4VModularPhysicsList {
public:
MyPhysicsList();
~MyPhysicsList();
virtual void SetCuts();
};
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * 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: Particles.cc,v 1.3 2006/06/29 15:28:25 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// Particles.cc
//
// Physics list for defining particles
//
// ====================================================================
#include "Particles.hh"
#include "G4LeptonConstructor.hh"
#include "G4BosonConstructor.hh"
#include "G4MesonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4IonConstructor.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////////////
Particles::Particles()
: G4VPhysicsConstructor("Particles")
//////////////////////////////////////
{
}
///////////////////////
Particles::~Particles()
///////////////////////
{
}
///////////////////////////////////
void Particles::ConstructParticle()
///////////////////////////////////
{
G4LeptonConstructor::ConstructParticle();
G4BosonConstructor::ConstructParticle();
G4MesonConstructor::ConstructParticle();
G4BaryonConstructor::ConstructParticle();
G4ShortLivedConstructor::ConstructParticle();
G4IonConstructor::ConstructParticle();
}
//////////////////////////////////
void Particles::ConstructProcess()
//////////////////////////////////
{
}
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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: Particles.hh,v 1.3 2006/06/29 15:28:27 gunter Exp $
// ====================================================================
// Particles.hh
//
// 2004 Q
// ====================================================================
#ifndef PARTICLES_H
#define PARTICLES_H
#include "G4VPhysicsConstructor.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class Particles : public G4VPhysicsConstructor {
public:
Particles();
~Particles();
virtual void ConstructParticle();
virtual void ConstructProcess();
};
#endif
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * 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: PhysicsListEMstd.cc,v 1.3 2006/06/29 15:28:29 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// PhysicsListEMstd.cc
//
// Physics list for electron/positron/gamma
// EM-standard package w/ default parameters
//
// ====================================================================
#include "PhysicsListEMstd.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
// ====================================================================
//
// class description
//
// ====================================================================
////////////////////////////////////
PhysicsListEMstd::PhysicsListEMstd()
: G4VPhysicsConstructor("EM-std")
////////////////////////////////////
{
}
/////////////////////////////////////
PhysicsListEMstd::~PhysicsListEMstd()
/////////////////////////////////////
{
}
//////////////////////////////////////////
void PhysicsListEMstd::ConstructParticle()
//////////////////////////////////////////
{
}
/////////////////////////////////////////
void PhysicsListEMstd::ConstructProcess()
/////////////////////////////////////////
{
G4ProcessManager* pm;
// ----------------------------------------------------------
// gamma physics
// ----------------------------------------------------------
pm= G4Gamma::Gamma()-> GetProcessManager();
pm-> AddDiscreteProcess(new G4PhotoElectricEffect);
pm-> AddDiscreteProcess(new G4ComptonScattering);
pm-> AddDiscreteProcess(new G4GammaConversion);
// ----------------------------------------------------------
// electron physics
// ----------------------------------------------------------
G4MultipleScattering* msc= new G4MultipleScattering;
G4eIonisation* eion= new G4eIonisation;
G4eBremsstrahlung* ebrems= new G4eBremsstrahlung;
pm= G4Electron::Electron()->GetProcessManager();
pm-> AddProcess(msc, ordInActive, 1, 1);
pm-> AddProcess(eion, ordInActive, 2, 2);
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
// ----------------------------------------------------------
// positron physics
// ----------------------------------------------------------
msc= new G4MultipleScattering;
eion= new G4eIonisation;
ebrems= new G4eBremsstrahlung;
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);
}
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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: PhysicsListEMstd.hh,v 1.3 2006/06/29 15:28:32 gunter Exp $
// ====================================================================
// PhysicsListEMstd.hh
//
// 2004 Q
// ====================================================================
#ifndef PHYSICS_LIST_EM_STD_H
#define PHYSICS_LIST_EM_STD_H
#include "G4VPhysicsConstructor.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class PhysicsListEMstd : public G4VPhysicsConstructor {
public:
PhysicsListEMstd();
~PhysicsListEMstd();
virtual void ConstructParticle();
virtual void ConstructProcess();
};
#endif
@@ -0,0 +1,396 @@
//
// ********************************************************************
// * 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: PhysicsListLHad.cc,v 1.3 2006/06/29 15:28:35 gunter Exp $
// ====================================================================
// PhysicsListLHad.cc
//
// Light package of hadron physics
// ====================================================================
#include "PhysicsListLHad.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4hIonisation.hh"
// Hadronic Processes
#include "G4HadronElasticProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4AntiProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4AntiNeutronInelasticProcess.hh"
#include "G4PionPlusInelasticProcess.hh"
#include "G4PionMinusInelasticProcess.hh"
#include "G4KaonPlusInelasticProcess.hh"
#include "G4KaonZeroSInelasticProcess.hh"
#include "G4KaonZeroLInelasticProcess.hh"
#include "G4KaonMinusInelasticProcess.hh"
// Low energy models
#include "G4LElastic.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
#include "G4LEProtonInelastic.hh"
#include "G4LEAntiProtonInelastic.hh"
#include "G4LENeutronInelastic.hh"
#include "G4LEAntiNeutronInelastic.hh"
#include "G4LEPionPlusInelastic.hh"
#include "G4LEPionMinusInelastic.hh"
#include "G4LEKaonPlusInelastic.hh"
#include "G4LEKaonZeroSInelastic.hh"
#include "G4LEKaonZeroLInelastic.hh"
#include "G4LEKaonMinusInelastic.hh"
// High-energy Models
#include "G4HEProtonInelastic.hh"
#include "G4HEAntiProtonInelastic.hh"
#include "G4HEPionPlusInelastic.hh"
#include "G4HEPionMinusInelastic.hh"
#include "G4HEKaonPlusInelastic.hh"
#include "G4HEKaonZeroInelastic.hh"
#include "G4HEKaonZeroInelastic.hh"
#include "G4HEKaonMinusInelastic.hh"
// Stopping processes
#include "G4AntiProtonAnnihilationAtRest.hh"
// Binary Cascade
#include "G4BinaryCascade.hh"
#include "G4ProtonInelasticCrossSection.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////////
PhysicsListLHad::PhysicsListLHad()
: G4VPhysicsConstructor("LHad")
//////////////////////////////////
{
}
///////////////////////////////////
PhysicsListLHad::~PhysicsListLHad()
///////////////////////////////////
{
}
/////////////////////////////////////////
void PhysicsListLHad::ConstructParticle()
/////////////////////////////////////////
{
}
////////////////////////////////////////
void PhysicsListLHad::ConstructProcess()
////////////////////////////////////////
{
G4ProcessManager* pManager;
// ---------------------------------------------------------------
// proton
// ---------------------------------------------------------------
pManager= G4Proton::Proton()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thepElasticProcess = new G4HadronElasticProcess();
G4LElastic* thepElasticModel = new G4LElastic();
thepElasticProcess->RegisterMe(thepElasticModel);
pManager-> AddDiscreteProcess(thepElasticProcess);
// inelastic
G4ProtonInelasticProcess* theProtonInelasticProcess
= new G4ProtonInelasticProcess();
G4HEProtonInelastic* theProtonHEPModel = new G4HEProtonInelastic();
G4LEProtonInelastic* theProtonLEPModel = new G4LEProtonInelastic();
theProtonLEPModel->SetMinEnergy(2.8*GeV);
G4BinaryCascade* theProtonBICModel = new G4BinaryCascade();
theProtonBICModel->SetMaxEnergy(3.2*GeV);
theProtonInelasticProcess-> RegisterMe(theProtonHEPModel);
theProtonInelasticProcess-> RegisterMe(theProtonLEPModel);
theProtonInelasticProcess-> RegisterMe(theProtonBICModel);
// add Xsection data of BIC
G4ProtonInelasticCrossSection* theProtonInelasticData
= new G4ProtonInelasticCrossSection();
theProtonInelasticProcess-> AddDataSet( theProtonInelasticData );
pManager-> AddDiscreteProcess(theProtonInelasticProcess);
// QED
G4VProcess* thepMultipleScattering = new G4MultipleScattering();
G4VProcess* thepIonisation = new G4hIonisation();
pManager-> AddProcess(thepIonisation);
pManager-> AddProcess(thepMultipleScattering);
pManager-> SetProcessOrdering(thepMultipleScattering, idxAlongStep, 1);
pManager-> SetProcessOrdering(thepIonisation, idxAlongStep, 2);
pManager-> SetProcessOrdering(thepMultipleScattering, idxPostStep, 1);
pManager-> SetProcessOrdering(thepIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// anti-proton
// ---------------------------------------------------------------
pManager= G4AntiProton::AntiProton()-> GetProcessManager();
// elastic
G4HadronElasticProcess* theapElasticProcess = new G4HadronElasticProcess();
G4LElastic* theapElasticModel = new G4LElastic();
theapElasticProcess-> RegisterMe(theapElasticModel);
pManager-> AddDiscreteProcess(theapElasticProcess);
// inelastic
G4AntiProtonInelasticProcess* theAntiProtonInelasticProcess
= new G4AntiProtonInelasticProcess();
G4LEAntiProtonInelastic* theAntiProtonLEPModel
= new G4LEAntiProtonInelastic();
G4HEAntiProtonInelastic* theAntiProtonHEPModel
= new G4HEAntiProtonInelastic();
theAntiProtonInelasticProcess-> RegisterMe(theAntiProtonLEPModel);
theAntiProtonInelasticProcess-> RegisterMe(theAntiProtonHEPModel);
pManager-> AddDiscreteProcess(theAntiProtonInelasticProcess);
G4AntiProtonAnnihilationAtRest* theAntiProtonAnnihilation
= new G4AntiProtonAnnihilationAtRest();
pManager-> AddRestProcess(theAntiProtonAnnihilation);
// QED
G4VProcess* theapMultipleScattering = new G4MultipleScattering();
G4VProcess* theapIonisation = new G4hIonisation();
pManager-> AddProcess(theapIonisation);
pManager-> AddProcess(theapMultipleScattering);
pManager->SetProcessOrdering(theapMultipleScattering, idxAlongStep, 1);
pManager->SetProcessOrdering(theapIonisation, idxAlongStep, 2);
pManager->SetProcessOrdering(theapMultipleScattering, idxPostStep, 1);
pManager->SetProcessOrdering(theapIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// mesons...
// ---------------------------------------------------------------
// ---------------------------------------------------------------
// pi+
// ---------------------------------------------------------------
pManager= G4PionPlus::PionPlus()-> GetProcessManager();
// elastic
G4HadronElasticProcess* theppElasticProcess = new G4HadronElasticProcess();
G4LElastic* theppElasticModel = new G4LElastic();
theppElasticProcess-> RegisterMe(theppElasticModel);
pManager-> AddDiscreteProcess(theppElasticProcess);
// inelastic
G4PionPlusInelasticProcess* thePionPlusInelasticProcess
= new G4PionPlusInelasticProcess();
G4LEPionPlusInelastic* thePionPlusLEPModel = new G4LEPionPlusInelastic();
G4HEPionPlusInelastic* thePionPlusHEPModel = new G4HEPionPlusInelastic();
thePionPlusInelasticProcess->RegisterMe(thePionPlusLEPModel);
thePionPlusInelasticProcess->RegisterMe(thePionPlusHEPModel);
pManager-> AddDiscreteProcess(thePionPlusInelasticProcess);
// QED
G4VProcess* theppMultipleScattering = new G4MultipleScattering();
G4VProcess* theppIonisation = new G4hIonisation();
pManager-> AddProcess(theppIonisation);
pManager-> AddProcess(theppMultipleScattering);
pManager-> SetProcessOrdering(theppMultipleScattering, idxAlongStep, 1);
pManager-> SetProcessOrdering(theppIonisation, idxAlongStep, 2);
pManager-> SetProcessOrdering(theppMultipleScattering, idxPostStep, 1);
pManager-> SetProcessOrdering(theppIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// pi-
// ---------------------------------------------------------------
pManager= G4PionMinus::PionMinus()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thepmElasticProcess = new G4HadronElasticProcess();
G4LElastic* thepmElasticModel = new G4LElastic();
thepmElasticProcess->RegisterMe(thepmElasticModel);
pManager-> AddDiscreteProcess(thepmElasticProcess);
// inelastic
G4PionMinusInelasticProcess* thePionMinusInelasticProcess
= new G4PionMinusInelasticProcess();
G4LEPionMinusInelastic* thePionMinusLEPModel = new G4LEPionMinusInelastic();
G4HEPionMinusInelastic* thePionMinusHEPModel = new G4HEPionMinusInelastic();
thePionMinusInelasticProcess-> RegisterMe(thePionMinusLEPModel);
thePionMinusInelasticProcess-> RegisterMe(thePionMinusHEPModel);
pManager-> AddDiscreteProcess(thePionMinusInelasticProcess);
// QED
G4VProcess* thepmMultipleScattering = new G4MultipleScattering();
G4VProcess* thepmIonisation = new G4hIonisation();
pManager-> AddProcess(thepmIonisation);
pManager-> AddProcess(thepmMultipleScattering);
pManager-> SetProcessOrdering(thepmMultipleScattering, idxAlongStep, 1);
pManager-> SetProcessOrdering(thepmIonisation, idxAlongStep, 2);
pManager-> SetProcessOrdering(thepmMultipleScattering, idxPostStep, 1);
pManager-> SetProcessOrdering(thepmIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// K+
// ---------------------------------------------------------------
pManager= G4KaonPlus::KaonPlus()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thekpElasticProcess = new G4HadronElasticProcess();
G4LElastic* thekpElasticModel = new G4LElastic();
thekpElasticProcess->RegisterMe(thekpElasticModel);
pManager->AddDiscreteProcess(thekpElasticProcess);
// inelastic
G4KaonPlusInelasticProcess* theKaonPlusInelasticProcess
= new G4KaonPlusInelasticProcess();
G4LEKaonPlusInelastic* theKaonPlusLEPModel = new G4LEKaonPlusInelastic();
G4HEKaonPlusInelastic* theKaonPlusHEPModel = new G4HEKaonPlusInelastic();
theKaonPlusInelasticProcess-> RegisterMe(theKaonPlusLEPModel);
theKaonPlusInelasticProcess-> RegisterMe(theKaonPlusHEPModel);
pManager-> AddDiscreteProcess(theKaonPlusInelasticProcess);
// QED
G4VProcess* thekpMultipleScattering = new G4MultipleScattering();
G4VProcess* thekpIonisation = new G4hIonisation();
pManager-> AddProcess(thekpIonisation);
pManager-> AddProcess(thekpMultipleScattering);
pManager-> SetProcessOrdering(thekpMultipleScattering, idxAlongStep, 1);
pManager-> SetProcessOrdering(thekpIonisation, idxAlongStep, 2);
pManager-> SetProcessOrdering(thekpMultipleScattering, idxPostStep, 1);
pManager-> SetProcessOrdering(thekpIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// K-
// ---------------------------------------------------------------
pManager= G4KaonMinus::KaonMinus()->GetProcessManager();
// elastic
G4HadronElasticProcess* thekmElasticProcess = new G4HadronElasticProcess();
G4LElastic* thekmElasticModel = new G4LElastic();
thekmElasticProcess->RegisterMe(thekmElasticModel);
pManager->AddDiscreteProcess(thekmElasticProcess);
// inelastic
G4KaonMinusInelasticProcess* theKaonMinusInelasticProcess
= new G4KaonMinusInelasticProcess();
G4LEKaonMinusInelastic* theKaonMinusLEPModel = new G4LEKaonMinusInelastic();
G4HEKaonMinusInelastic* theKaonMinusHEPModel = new G4HEKaonMinusInelastic();
theKaonMinusInelasticProcess->RegisterMe(theKaonMinusLEPModel);
theKaonMinusInelasticProcess->RegisterMe(theKaonMinusHEPModel);
pManager->AddDiscreteProcess(theKaonMinusInelasticProcess);
// QED
G4VProcess* thekmMultipleScattering = new G4MultipleScattering();
G4VProcess* thekmIonisation = new G4hIonisation();
pManager-> AddProcess(thekmIonisation);
pManager-> AddProcess(thekmMultipleScattering);
pManager->SetProcessOrdering(thekmMultipleScattering, idxAlongStep, 1);
pManager->SetProcessOrdering(thekmIonisation, idxAlongStep, 2);
pManager->SetProcessOrdering(thekmMultipleScattering, idxPostStep, 1);
pManager->SetProcessOrdering(thekmIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// K0L
// ---------------------------------------------------------------
pManager= G4KaonZeroLong::KaonZeroLong()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thek0lElasticProcess = new G4HadronElasticProcess();
G4LElastic* thek0lElasticModel = new G4LElastic();
thek0lElasticProcess-> RegisterMe(thek0lElasticModel);
pManager-> AddDiscreteProcess(thek0lElasticProcess);
// inelastic
G4KaonZeroLInelasticProcess* theKaonZeroLInelasticProcess
= new G4KaonZeroLInelasticProcess();
G4LEKaonZeroLInelastic* theKaonZeroLLEPModel = new G4LEKaonZeroLInelastic();
G4HEKaonZeroInelastic* theKaonZerolHEPModel = new G4HEKaonZeroInelastic();
theKaonZeroLInelasticProcess-> RegisterMe(theKaonZeroLLEPModel);
theKaonZeroLInelasticProcess-> RegisterMe(theKaonZerolHEPModel);
pManager-> AddDiscreteProcess(theKaonZeroLInelasticProcess);
// ---------------------------------------------------------------
// K0S
// ---------------------------------------------------------------
pManager= G4KaonZeroShort::KaonZeroShort()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thek0sElasticProcess = new G4HadronElasticProcess();
G4LElastic* thek0sElasticModel = new G4LElastic();
thek0sElasticProcess-> RegisterMe(thek0sElasticModel);
pManager-> AddDiscreteProcess(thek0sElasticProcess);
// inelastic
G4KaonZeroSInelasticProcess* theKaonZeroSInelasticProcess
= new G4KaonZeroSInelasticProcess();
G4LEKaonZeroSInelastic* theKaonZeroSLEPModel = new G4LEKaonZeroSInelastic();
G4HEKaonZeroInelastic* theKaonZerosHEPModel = new G4HEKaonZeroInelastic();
theKaonZeroSInelasticProcess-> RegisterMe(theKaonZeroSLEPModel);
theKaonZeroSInelasticProcess-> RegisterMe(theKaonZerosHEPModel);
pManager-> AddDiscreteProcess(theKaonZeroSInelasticProcess);
}
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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: PhysicsListLHad.hh,v 1.3 2006/06/29 15:28:37 gunter Exp $
// ====================================================================
// PhysicsListLHad.hh
//
// 2004 Q
// ====================================================================
#ifndef PHYSICS_L_HAD_H
#define PHYSICS_L_HAD_H
#include "G4VPhysicsConstructor.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class PhysicsListLHad : public G4VPhysicsConstructor {
public:
PhysicsListLHad();
~PhysicsListLHad();
virtual void ConstructParticle();
virtual void ConstructProcess();
};
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pydemo_wp.cc,v 1.3 2006/06/29 15:28:40 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pydemo_wp.cc
//
// python wrapper for user application
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "MyMaterials.hh"
#include "MyDetectorConstruction.hh"
#include "MyPhysicsList.hh"
#include "G4VSensitiveDetector.hh"
using namespace boost::python;
// ====================================================================
// Expose to Python
// ====================================================================
BOOST_PYTHON_MODULE(demo_wp) {
class_<MyMaterials>("MyMaterials", "my material")
.def("Construct", &MyMaterials::Construct)
;
class_<MyDetectorConstruction, MyDetectorConstruction*,
bases<G4VUserDetectorConstruction> >
("MyDetectorConstruction", "my detector")
.def("SetSDtoScoreVoxel", &MyDetectorConstruction::SetSDtoScoreVoxel)
;
class_<MyPhysicsList, MyPhysicsList*,
bases<G4VUserPhysicsList> >
("MyPhysicsList", "my physics list")
;
}
+92
View File
@@ -0,0 +1,92 @@
#!/usr/bin/python
# ==================================================================
# python script for Geant4Py test
#
# ==================================================================
from Geant4 import *
import demo_wp
# ==================================================================
# user actions in python
# ==================================================================
class MyPrimaryGeneratorAction(G4VUserPrimaryGeneratorAction):
"My Primary Generator Action"
def __init__(self):
G4VUserPrimaryGeneratorAction.__init__(self)
self.particleGun= G4ParticleGun(1)
def GeneratePrimaries(self, event):
self.particleGun.GeneratePrimaryVertex(event)
# ------------------------------------------------------------------
class MyRunAction(G4UserRunAction):
"My Run Action"
def EndOfRunAction(self, run):
print "*** End of Run"
print "- Run sammary : (id= %d, #events= %d)" \
% (run.GetRunID(), run.GetNumberOfEventToBeProcessed())
# ------------------------------------------------------------------
class MyEventAction(G4UserEventAction):
"My Event Action"
def EndOfEventAction(self, event):
pass
# ------------------------------------------------------------------
class MySteppingAction(G4UserSteppingAction):
"My Stepping Action"
def UserSteppingAction(self, step):
pass
#print "*** dE/dx in current step=", step.GetTotalEnergyDeposit()
preStepPoint= step.GetPreStepPoint()
track= step.GetTrack()
touchable= track.GetTouchable()
#print "*** vid= ", touchable.GetReplicaNumber()
# ==================================================================
# main
# ==================================================================
myMaterials= demo_wp.MyMaterials()
myMaterials.Construct()
myDC= demo_wp.MyDetectorConstruction()
gRunManager.SetUserInitialization(myDC)
myPL= demo_wp.MyPhysicsList()
gRunManager.SetUserInitialization(myPL)
# set user actions...
myPGA= MyPrimaryGeneratorAction()
gRunManager.SetUserAction(myPGA)
myRA= MyRunAction()
gRunManager.SetUserAction(myRA)
myEA= MyEventAction()
gRunManager.SetUserAction(myEA)
mySA= MySteppingAction()
gRunManager.SetUserAction(mySA)
# set particle gun
pg= myPGA.particleGun
pg.SetParticleByName("proton")
pg.SetParticleEnergy(230.*HEPUnit.MeV)
pg.SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.))
pg.SetParticlePosition(G4ThreeVector(0.,0.,-20.)*HEPUnit.cm)
gRunManager.Initialize()
# visualization
gApplyUICommand("/control/execute vis.mac")
# beamOn
#gRunManager.BeamOn(3)
@@ -0,0 +1,17 @@
# vis.mac
/vis/open OGLIX
#/vis/open OGLSX
/vis/scene/create
/vis/scene/add/volume
/vis/sceneHandler/attach
/vis/viewer/set/viewpointThetaPhi 90. 0.
/tracking/storeTrajectory 1
/vis/scene/add/trajectories
/vis/scene/endOfEventAction accumulate
#/vis/scene/endOfEventAction refresh
@@ -0,0 +1,24 @@
09 March 2006
Hajime Yoshida
The first version of mass attenuation coefficient
- Lesson1.py
select absorber material
set its thickness upto 500 mm
select beam particle
set its energy upto 100 MeV
set nu of events up to 100
run
and then
zoom in (x1.1) or zoom out (x0.9)
execute any G4 command but /gun/particle or /gun/energy which are
defined by the above
-oglx.mac
OGLSX => important to make zooming effective after showing trajectories
-gun.mac
@@ -0,0 +1,296 @@
#!/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 EMSTDpl
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
# ------------------------------------------------------------------
EMSTDpl.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-"):
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)
#Zoom in/out Pan X Y row=8
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=8, column=0, sticky=W)
expandBut.grid(row=8, column=1, sticky=W)
shrinkBut.grid(row=8, 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=8, column=3, sticky=W)
downBut.grid(row=8, 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=8, column=5, sticky=W)
rightBut.grid(row=8, 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_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()
@@ -0,0 +1,40 @@
09 March 2006
26 May 2006 Geant4.8.1
Hajime Yoshida
The first version of the courseware of the mass attenuation coefficient
- Lesson1.py
select absorber material
set its thickness upto 500 mm
select beam particle
set its energy upto 100 MeV
set nu of events up to 100
run
and then
zoom in (x1.1) or zoom out (x0.9)
pan in up/down and/or right/left in the unit of mm (type in two
numbers separated by a space)
execute any G4 command but /gun/particle or /gun/energy which are
defined by the above
-oglx.mac
OGLSX => important to make zooming effective after showing trajectories.
if you want to use VRML, you have to specify the directory where *.wrl
file is stored and the VRML viewer to which the path is set:
G4VRMLFILE_DEST_DIR=/home/yoshidah/tmp/
G4VRMLFILE_VIEWER=vrmlview
And you have VRML drivers built.
G4VIS_BUILD_VRML_DRIVER=1
G4VIS_USE_VRMLFILE=1
G4VIS_BUILD_VRMLFILE_DRIVER=1
G4VIS_USE_VRML=1
-gun.mac
This is used only at the initialization time.
@@ -0,0 +1,8 @@
# gun.mac
/gun/number 1
/gun/particle e-
/gun/energy 0.2 MeV
/gun/direction 0. 0. 1.
/gun/position 0. -5. -30. cm
@@ -0,0 +1,29 @@
# vis.mac
#OpenGL Stored mode to accumulate trajectories
/vis/open OGLSX
#VRML viewer is usable if you defined env variables
#/vis/open VRML2FILE
/vis/viewer/refresh
/vis/scene/create
/vis/scene/add/volume
#/vis/scene/add/axes 0 0 0 2 m
#/vis/drawVolume
/vis/viewer/set/style s
/vis/sceneHandler/attach
/vis/viewer/set/viewpointThetaPhi 90. 0.
/vis/viewer/zoom 1.5
#/vis/scene/add/text 0 610 610 mm 20 -0 -0 Geant4Py
/tracking/storeTrajectory 1
/vis/scene/add/trajectories
/vis/scene/endOfEventAction accumulate
/vis/scene/endOfRunAction accumulate
+426
View File
@@ -0,0 +1,426 @@
#!/usr/bin/python
# ==================================================================
# python script for Geant4Py
#
# ExN03 : geant4/examples/novice/N03
# using site-module packages
# ==================================================================
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()
#EMSTDpl.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()
# beamOn
#gRunManager.BeamOn(3)
#TEST
#gProcessTable.SetProcessActivation("msc", 0)
#gProcessTable.SetProcessActivation("conv", 0)
#gProcessTable.SetProcessActivation("eBrem", 0)
#gProcessTable.SetProcessActivation("eIoni", 0)
#gProcessTable.SetProcessActivation("annihil", 0)
# 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
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")
# creating widgets using grid layout
from Tkinter import *
class App(Frame):
g4pipe = 0
def init(self):
#title and header row=0, 1
title = Label(self, text="exampleN03")
title.grid(row=0, column=1, columnspan=3)
header = Label(self, text="empowered by \n Geant4Py")
header.grid(row=1, column=1, columnspan=3)
# number of layers
layerLabel = Label(self, bg="green", text="No of layers")
self.layerVar=IntVar()
self.layerVar.set(10)
layer = Scale(self, orient=HORIZONTAL, length=400, from_=0, to=10, tickinterval=1, resolution=1, variable=self.layerVar )
layerLabel.grid(row=2, column=0, sticky=W)
layer.grid(row=2, column=1, columnspan=5, sticky=W)
#absorber material selection row=3
absorbermaterialLabel = Label(self, bg="green", text="Absorber Material")
absorbermaterialLabel.grid(row=3, column=0, sticky=W)
self.absorbermaterialVar = StringVar()
self.absorbermaterialVar.set("Lead")
ra1 = { }
pos=1
for i in ("Aluminium", "Lead"):
ra1[i] = Radiobutton(self, text=i, variable=self.absorbermaterialVar, value=i)
ra1[i].grid(row=3, column=pos, sticky=W)
pos=pos+1
#absorber thickness row=4
absorberthickLabel = Label(self, bg="green", text="Thickness (mm)")
self.absorberthickVar = DoubleVar()
self.absorberthickVar.set(10.0)
absorberthick = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=100., resolution=0.05, tickinterval=10.0, digits=4, variable=self.absorberthickVar)
absorberthickLabel.grid(row=4, column=0, sticky=W)
absorberthick.grid(row=4, column=1, columnspan=5, sticky=W)
#gap material selection row=5
gapmaterialLabel = Label(self, bg="green", text="Gap Material")
gapmaterialLabel.grid(row=5, column=0, sticky=W)
self.gapmaterialVar = StringVar()
self.gapmaterialVar.set("liquidArgon")
ra2 = { }
pos=1
for i in ("liquidArgon","Scintillator", "Air", "Aerogel", "Galactic" ):
ra2[i] = Radiobutton(self, text=i, variable=self.gapmaterialVar, value=i)
ra2[i].grid(row=5, column=pos, sticky=W)
pos=pos+1
#gap thickness row=6
gapthickLabel = Label(self, bg="green", text="Thickness (mm)")
self.gapthickVar = DoubleVar()
self.gapthickVar.set(5.0)
gapthick = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=100., resolution=0.05, tickinterval=10.0, digits=4, variable=self.gapthickVar)
gapthickLabel.grid(row=6, column=0, sticky=W)
gapthick.grid(row=6, column=1, columnspan=5, sticky=W)
#calorSizeYZ row=7
calorsizeYZLabel = Label(self, bg="green", text="SizeYZ (mm)")
self.calorsizeYZVar = DoubleVar()
self.calorsizeYZVar.set(100.0)
calorsizeYZ = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=200., resolution=0.05, tickinterval=20.0, digits=4, variable=self.calorsizeYZVar)
calorsizeYZLabel.grid(row=7, column=0, sticky=W)
calorsizeYZ.grid(row=7, column=1, columnspan=5, sticky=W)
#particle row=8
particleLabel = Label(self, bg="green", text="Particle")
particleLabel.grid(row=8, column=0, sticky=W)
self.particleVar = StringVar()
self.particleVar.set("e-")
ra1 = { }
pos1=1
for i in ("proton", "gamma", "e-", "e+", "mu-", "mu+"):
ra1[i] = Radiobutton(self, text=i, variable=self.particleVar, value=i)
ra1[i].grid(row=8, column=pos1, sticky=W)
pos1=pos1+1
#energy row=9
energyLabel = Label(self, bg="green", text="Energy (MeV)")
self.energyVar=StringVar()
self.energyVar.set(50)
energy = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=1000., tickinterval=100.0, resolution=0.1, variable=self.energyVar, digits=5 )
energyLabel.grid(row=9, column=0, sticky=W)
energy.grid(row=9, column=1, columnspan=5, sticky=W)
#number of event row=10
eventLabel = Label(self, bg="green", text="Events")
self.eventVar=IntVar()
self.eventVar.set(3)
event = Scale(self, orient=HORIZONTAL, length=400, from_=0, to=100, tickinterval=10, resolution=1, variable=self.eventVar )
eventLabel.grid(row=10, column=0, sticky=W)
event.grid(row=10, column=1, columnspan=5, sticky=W)
#start a run button row=0
startBut = Button(self, bg="orange", text="Start a run", command=self.cmd_beamOn)
startBut.grid(row=0, column=0, sticky=W)
#Zoom in/out Pan X Y row=13
# 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=13, column=0, sticky=W)
# expandBut.grid(row=13, column=1, sticky=W)
# shrinkBut.grid(row=13, column=2, sticky=W)
# panLabel = Label(self, text="Pan X Y(mm)")
# self.panXYVar = StringVar()
# panXYEnt = Entry(self, textvariable=self.panXYVar, width=6)
# panBut = Button(self, bg="orange", text="OK", command=self.cmd_pan)
# panLabel.grid(row=13, column=3, sticky=W)
# panXYEnt.grid(row=13, column=4)
# panBut.grid(row=13, column=5)
# process activate row 11 - 13
processLabel=Label(self, text="Process on/off", bg="green")
processLabel.grid(row=11, column=0, sticky=W)
procTab = {}
self.processList = ["phot", "compt", "conv", "msc", "eIoni", "eBrem", "annihil","muIoni", "muBrems", "hIoni"]
pos=1
self.processVar = {}
for i in self.processList:
self.processVar[i] = IntVar()
procTab[i] = Checkbutton(self, text=i, variable=self.processVar[i], command=self.cmd_setProcess)
if pos <= 3:
procTab[i].grid(row=11, column=pos, sticky=W)
if 4<= pos <= 7:
procTab[i].grid(row=12, column=pos-3, sticky=W)
if pos >= 8:
procTab[i].grid(row=13, column=pos-7, sticky=W)
pos=pos+1
procTab[i].select()
# set cuts row 14
cutLabel = Label(self, bg="green", text="Cut (mm)")
self.cutVar=DoubleVar()
self.cutVar.set(1.)
cut = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=10., tickinterval=1., resolution=0.005, variable=self.cutVar, digits=5 )
cutLabel.grid(row=14, column=0, sticky=W)
cut.grid(row=14, column=1, columnspan=5, sticky=W)
# set mag field row 15
magLabel = Label(self, bg="green", text="Magnetic (T)")
self.magVar=DoubleVar()
self.magVar.set(0.)
mag = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=5., tickinterval=1., resolution=0.1, variable=self.magVar, digits=3 )
magLabel.grid(row=15, column=0, sticky=W)
mag.grid(row=15, column=1, columnspan=5, sticky=W)
# viewer selection row=16
viewerLabel = Label(self, bg="green", text="Viewer")
viewerLabel.grid(row=16, column=0, sticky=W)
self.viewerVar = StringVar()
self.viewerVar.set("")
stateOfViewer = {"OpenGL":"normal", "VRML":"normal", "Wired":"normal"}
if vrmlViewer is None: stateOfViewer["VRML"] = "disabled"
if heprepViewer is None: stateOfViewer["Wired"] = "disabled"
viewers = { }
pos=1
for i in ("OpenGL", "VRML", "Wired"):
viewers[i] = Radiobutton(self, text=i, variable=self.viewerVar, value=i, command=self.cmd_viewer, state=stateOfViewer[i])
viewers[i].grid(row=16, column=pos, sticky=W)
pos=pos+1
#Geant4 command entry row = 17
g4comLabel = Label(self, text="Geant4 command", bg="orange")
self.g4commandVar = StringVar()
commandEntry = Entry(self, textvariable=self.g4commandVar, width=15)
self.g4commandVar.set("/vis/viewer/zoom 1.2")
comBut = Button(self, bg="orange", text="Execute", command=self.cmd_g4command)
g4comLabel.grid(row=17, column=0, sticky=W)
commandEntry.grid(row=17, column=1, columnspan=3, sticky=E+W)
comBut.grid(row=17, column=5)
#exit row = 0
exitBut = Button(self, bg="red", text="End all", command=sys.exit)
exitBut.grid(row=0, column=5, sticky=W)
#on Run butto do...
def cmd_beamOn(self):
exN03geom.SetNbOfLayers(self.layerVar.get())
exN03geom.SetAbsorberMaterial(self.absorbermaterialVar.get())
exN03geom.SetAbsorberThickness(self.absorberthickVar.get() * mm/2.0)
exN03geom.SetGapMaterial(self.gapmaterialVar.get())
exN03geom.SetGapThickness(self.gapthickVar.get() * mm/2.0)
exN03geom.SetCalorSizeYZ(self.calorsizeYZVar.get() * mm)
position = -self.layerVar.get()*(self.absorberthickVar.get() + self.gapthickVar.get())*1.2
exN03geom.UpdateGeometry()
exN03PL.SetDefaultCutValue(self.cutVar.get() * mm)
exN03PL.SetCutsWithDefault()
exN03geom.SetMagField(self.magVar.get() * tesla)
print "Now geometry updated"
self.cmd_particle(self.particleVar.get())
self.cmd_energy(self.energyVar.get())
print position
eventNum = self.eventVar.get()
for i in range(eventNum):
pg.SetParticlePosition(G4ThreeVector(position*mm, (i-eventNum/2)*5.*mm, 0.*cm))
gRunManager.BeamOn(1)
sleep(0.01)
gApplyUICommand("/vis/viewer/update")
def cmd_setProcess(self):
for i in self.processList:
if self.processVar[i].get() == 0:
gProcessTable.SetProcessActivation(i, 0)
print "Process " + i + " inactivated"
else:
gProcessTable.SetProcessActivation(i, 1)
print "Process " + i + " activated"
def cmd_g4command(self):
gApplyUICommand(self.g4commandVar.get())
def cmd_particle(self, particle):
gApplyUICommand("/gun/particle " + particle)
def cmd_energy(self, penergy):
gApplyUICommand("/gun/energy " + penergy + " MeV")
def cmd_viewer(self):
if self.viewerVar.get() == "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.viewerVar.get() == "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.viewerVar.get() == "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")
if self.g4pipe == 0:
Popen(heprepViewer + " -file " + heprepDir + "/" + heprepName +".heprep", shell=True)
self.g4pipe = 1
def cmd_expand(self):
gApplyUICommand("/vis/viewer/zoom 1.2")
def cmd_pan(self):
gApplyUICommand("/vis/viewer/pan " + self.panXYVar.get() + " " + " mm")
def cmd_shrink(self):
gApplyUICommand("/vis/viewer/zoom 0.8")
def __init__(self, master=None):
Frame.__init__(self, master)
self.init()
self.grid()
app = App()
app.mainloop()
@@ -0,0 +1,77 @@
26 May 2006
revised 02 July 2006
Geant4.8.1 release
===============================================
Prerequisites for G4 environment variables.
==============================================
This scripts offers the choice of visualization systems;
one among OGLSX (OpenGL stored mode), or VRML2FILE or Wired3.
OGLSX is the default viewer and you need no environment variables.
To use VRML2FILE you have to specify its viewer which is found in your
search path and the destination directory where *.wrl file is stored.
If you don't specify the name of the viewer, you can't choose it on the panel.
For example,
setenv G4VRMLFILE_VIEWER $HOME/bin/vrmlview
setenv G4VRMLFILE_DEST_DIR $HOME/tmp/ <= terminate with /
To use Wired, download it and install under your directory. Java Runtime
Environment is necessary.
Then set, for example;
setenv G4HEPREPFILE_VIEWER $HOME/Wired/bin/wired <= any path you use
setenv G4HEPREPFILE_DIR $HOME/tmp/
setenv G4HEPREPFILE_NAME lesson2_00 <= any name you choose.
setenv G4HEPREPFILE_OVERWRITE 1 <= to reuse the file for "next event"
G4HEPREPFILE_VIEWER isn't an official Geant4 environment variable but is employed
here to control the vissssualization viewers.
The name of the HepRepFile is ${G4HEPREPFILE_NAME}.heprep which will be
stored in ${G4HEPREPFILE_DIR}.
ExN03.py script don't use VRML or Wired if their *_VIEWER isn't set.
But other env variables are also used in the script to look for the
file and to activate the viewer, you have to set all of the above variables
in the shell where you activate ExN03.py script.
NOTICE) VRML viewer blocks the window (modal), so that you have to exit it to
display another run.
********* ExN03.py script ***********
This example id derived from examples/novice/N03.
You can
- choose the materials of absorber and gap
- set the thickness of the absorber and gap
- set the lateral (in YZ plane) size of the sandwitch cal.
- choose an incedent particle
- set its energy
- set the number of events to run
- toggle on/off of the electromagnetic processes
- set cut length
- set magnetic field
- typein any Geant4 command (except related with the above functions) and execute it
How to run it?
%python ExN03.py
You can visualize with OpenGL stored mode or VRML or Wired3
You can choose either of the active viewers by pushing the
radio buttons.
=========================
NOTICE)
VRML viewer runs in the modal action, and you have to exit it
to have a new diaplay for the new run, or you want to switch to
another viewer.
Wired has the "next"/"previous" event button. So to see the next
event, first run and then "next" event. Wired doesn't block G4
and you can have Wired and OGLSX both open.
ExN03-Wired.py is OBSOLETE. Please use ExN03.py
+121
View File
@@ -0,0 +1,121 @@
#!/usr/bin/python
# ==================================================================
# An example of ploting by EmCalculator
#
# Plotting photon cross sections and stopping power with ROOT
# ==================================================================
from Geant4 import *
import NISTmaterials
from EZsim import *
# ==================================================================
# geometry setup
# ==================================================================
# ------------------------------------------------------------------
# setup
# ------------------------------------------------------------------
def Configure():
NISTmaterials.Construct()
EZgeom.Construct()
# ------------------------------------------------------------------
# constructing geometry
# ------------------------------------------------------------------
def SetMaterial(material_name):
material= gNistManager.FindOrBuildMaterial(material_name)
EZgeom.SetWorldMaterial(material)
# ==================================================================
# plot by ROOT
# ==================================================================
import ROOT
from math import log, log10, sqrt, ceil, floor
from array import array
# ------------------------------------------------------------------
# caclculate plot range
# ------------------------------------------------------------------
def plot_range(xmin, xmax, xmargin=0.):
xmaxlog= 10
xminlog= -10
if(xmax!=0.):
xmaxlog= log10(xmax)
if(xmin!=0):
xminlog= log10(xmin)
ixmaxlog= xmaxlog+0.5
ixminlog= xminlog-0.5-xmargin
return [10**ixminlog, 10**ixmaxlog]
# ------------------------------------------------------------------
# ROOT init
# ------------------------------------------------------------------
def init_root():
ROOT.gROOT.Reset()
# plot style
ROOT.gStyle.SetTextFont(82)
ROOT.gStyle.SetTitleFont(82, "X")
ROOT.gStyle.SetTitleFontSize(0.04)
ROOT.gStyle.SetLabelFont(82, "X")
ROOT.gStyle.SetTitleFont(82, "Y")
ROOT.gStyle.SetLabelFont(82, "Y")
#ROOT.gStyle.SetOptTitle(0)
ROOT.gStyle.SetErrorX(0)
canvas= ROOT.TCanvas("g4plot", "g4plot", 620, 30, 600, 600)
canvas.SetLogy()
canvas.SetLogx()
canvas.SetGrid()
return canvas
# ------------------------------------------------------------------
# do a plot
# ------------------------------------------------------------------
def make_plot(xlist, user_title, axis_titile, q_super_impose=0):
ekin_array, y_array = array('d'), array('d')
for x in xlist:
ekin_array.append(x[0])
y_array.append(x[1])
# plot range
xmin= min(ekin_array)
xmax= max(ekin_array)
xrange= plot_range(xmin, xmax)
ymin= min(y_array)
ymax= max(y_array)
yrange= plot_range(ymin, ymax, 2)
if(q_super_impose==0):
htit= user_title
global frame
frame= ROOT.TH1F("dumy", htit, 1, xrange[0], xrange[1]);
frame.SetMinimum(yrange[0]);
frame.SetMaximum(yrange[1]);
frame.SetXTitle("Kinetic Energy (MeV)")
frame.GetXaxis().SetLabelSize(0.025)
frame.GetXaxis().SetTitleSize(0.03)
frame.SetYTitle(axis_titile)
frame.GetYaxis().SetLabelSize(0.025)
frame.GetYaxis().SetTitleSize(0.03)
frame.SetStats(0)
frame.Draw()
plot= ROOT.TGraph(len(ekin_array), ekin_array, y_array)
plot.Draw("L")
plot.SetLineColor(q_super_impose+1)
return plot
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/python
# ==================================================================
# An example of ploting by EmCalculator
#
# Plotting photon cross sections and stopping power
# ==================================================================
from Geant4 import *
import ExN03pl
import EmPlot
# initialize
EmPlot.Configure()
# user physics list
ExN03pl.Construct()
# target material
material= "G4_Cu"
EmPlot.SetMaterial(material)
# initialize G4 kernel
gRunManager.Initialize()
gRunManagerKernel.RunInitialization()
# energy
elist= []
for n in range(-3, 3):
for i in range(10,99):
elist.append(i/10.*10.**n *MeV)
# calculate stopping power
pname= "e-"
dedx_list= CalculateDEDX(pname, material, elist, 1)
xlist_tot=[]
xlist_ioni=[]
xlist_brems=[]
for x in dedx_list:
xlist_tot.append((x[0], x[1]["tot"]/(MeV*cm2/g)))
xlist_ioni.append((x[0], x[1]["ioni"]/(MeV*cm2/g)))
xlist_brems.append((x[0], x[1]["brems"]/(MeV*cm2/g)))
# make plot
myCanvas= EmPlot.init_root()
aplot= EmPlot.make_plot(xlist_tot, pname+" Stopping Power ("+material+")",
"dE/dX (MeV cm^{2}/g)")
bplot= EmPlot.make_plot(xlist_ioni, "Stopping Power ("+material+")",
"dE/dX (MeV cm^{2}/g)", 1)
cplot= EmPlot.make_plot(xlist_brems, "Stopping Power ("+material+")",
"dE/dX (MeV cm^{2}/g)", 3)
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/python
# ==================================================================
# An example of ploting by EmCalculator
#
# Plotting photon cross sections and stopping power
# ==================================================================
from Geant4 import *
import ExN03pl
import EmPlot
# initialize
EmPlot.Configure()
# user physics list
ExN03pl.Construct()
# target material
material= "G4_Pb"
EmPlot.SetMaterial(material)
# initialize G4 kernel
gRunManager.Initialize()
gRunManagerKernel.RunInitialization()
# energy
elist= []
for n in range(-3, 4):
for i in range(10,99):
elist.append(i/10.*10.**n *MeV)
# calculate cross sections
xsection_list= CalculatePhotonCrossSection(material, elist, 1)
xlist_tot=[]
xlist_comp=[]
xlist_pe=[]
xlist_conv=[]
for x in xsection_list:
xlist_tot.append((x[0]/MeV, x[1]["tot"]/(cm2/g)))
xlist_comp.append((x[0]/MeV, x[1]["compt"]/(cm2/g)))
xlist_pe.append((x[0]/MeV, x[1]["phot"]/(cm2/g)))
xlist_conv.append((x[0]/MeV, x[1]["conv"]/(cm2/g)))
# make a plot
myCanvas= EmPlot.init_root()
aplot= EmPlot.make_plot(xlist_tot, "Photon Cross Section ("+material+")",
"Cross Section (cm^{2}/g)")
bplot= EmPlot.make_plot(xlist_comp, "Photon Cross Section ("+material+")",
"Cross Section (cm^{2}/g)", 1)
cplot= EmPlot.make_plot(xlist_pe, "Photon Cross Section ("+material+")",
"Cross Section (cm^{2}/g)", 7)
dplot= EmPlot.make_plot(xlist_conv, "Photon Cross Section ("+material+")",
"Cross Section (cm^{2}/g)", 3)
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * 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: EzDetectorConstruction.cc,v 1.3 2006/06/29 15:28:43 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// EzDetectorConstruction.cc
//
// 2005 Q
// ====================================================================
#include "EzDetectorConstruction.hh"
#include "G4EzWorld.hh"
// ====================================================================
//
// class description
//
// ====================================================================
////////////////////////////////////////////////
EzDetectorConstruction::EzDetectorConstruction()
////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////
EzDetectorConstruction::~EzDetectorConstruction()
/////////////////////////////////////////////////
{
}
//////////////////////////////////////////////////////
G4VPhysicalVolume* EzDetectorConstruction::Construct()
//////////////////////////////////////////////////////
{
return G4EzWorld::GetWorldVolume();
}
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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: EzDetectorConstruction.hh,v 1.3 2006/06/29 15:28:46 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// EzDetectorConstruction.hh
//
// 2005 Q
// ====================================================================
#ifndef EZ_DETECTOR_CONSTRUCTION_H
#define EZ_DETECTOR_CONSTRUCTION_H
#include "G4VUserDetectorConstruction.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class EzDetectorConstruction : public G4VUserDetectorConstruction {
public:
EzDetectorConstruction();
~EzDetectorConstruction();
virtual G4VPhysicalVolume* Construct();
};
#endif
@@ -0,0 +1,44 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 08:58:18 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# -----------------------------------------------------------
# library
# -----------------------------------------------------------
SUBDIR := ezgeom
.PHONY: all cleanall
all:
@cd $(SUBDIR) && $(MAKE)
@$(MAKE) $(module_name)
installall:
@cd $(SUBDIR) && $(MAKE) install
@$(MAKE) install
cleanall:
@cd $(SUBDIR) && $(MAKE) clean
@-rm -f $(module_name)
@-rm -f *.o
# -----------------------------------------------------------
# module
# -----------------------------------------------------------
# python module name
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
CXXFLAGS += -I./$(SUBDIR)
LOPT += -L./$(SUBDIR) -lezgeom
@@ -0,0 +1,313 @@
//
// ********************************************************************
// * 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: G4EzVolume.cc,v 1.3 2006/06/29 15:28:52 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// G4EzVolume.cc
//
// 2005 Q
// ====================================================================
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Cons.hh"
#include "G4Sphere.hh"
#include "G4Orb.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4PVParameterised.hh"
#include "G4VisAttributes.hh"
#include "G4EzWorld.hh"
#include "G4EzVolume.hh"
#include "G4EzVoxelParameterization.hh"
// ====================================================================
//
// class description
//
// ====================================================================
////////////////////////
G4EzVolume::G4EzVolume()
: name("MyVolume"),
solid(0),
lv(0), lvsub(0),
nplacement(0)
////////////////////////
{
}
/////////////////////////////////////////////
G4EzVolume::G4EzVolume(const G4String& aname)
: name(aname), solid(0), lv(0), lvsub(0),
nplacement(0)
/////////////////////////////////////////////
{
}
/////////////////////////
G4EzVolume::~G4EzVolume()
/////////////////////////
{
}
///////////////////////////////////////////////////////////////////////
void G4EzVolume::CreateBoxVolume(G4Material* amaterial,
G4double dx, G4double dy, G4double dz)
///////////////////////////////////////////////////////////////////////
{
if(lv !=0 ) {
G4cout << "%%% Warning (G4EzVolume): volume is already created."
<< G4endl;
return;
}
solid= new G4Box(name, dx/2., dy/2., dz/2.);
lv= new G4LogicalVolume(solid, amaterial, name);
// vis. attributes
va= new G4VisAttributes();
lv-> SetVisAttributes(va);
}
////////////////////////////////////////////////////////////////////////////
void G4EzVolume::CreateTubeVolume(G4Material* amaterial,
G4double rmin, G4double rmax, G4double dz,
G4double phi0, G4double dphi)
////////////////////////////////////////////////////////////////////////////
{
if(lv !=0 ) {
G4cout << "%%% Warning (G4EzVolume): volume is already created."
<< G4endl;
return;
}
solid= new G4Tubs(name, rmin, rmax, dz, phi0, dphi);
lv= new G4LogicalVolume(solid, amaterial, name);
// vis. attributes
va= new G4VisAttributes();
lv-> SetVisAttributes(va);
}
/////////////////////////////////////////////////////////////////
void G4EzVolume::CreateConeVolume(G4Material* amaterial,
G4double rmin1, G4double rmax1,
G4double rmin2, G4double rmax2,
G4double dz,
G4double phi0, G4double dphi)
/////////////////////////////////////////////////////////////////
{
if(lv !=0 ) {
G4cout << "%%% Warning (G4EzVolume): volume is already created."
<< G4endl;
return;
}
solid= new G4Cons(name, rmin1, rmax1, rmin2, rmax2,
dz, phi0, dphi);
lv= new G4LogicalVolume(solid, amaterial, name);
// vis. attributes
va= new G4VisAttributes();
lv-> SetVisAttributes(va);
}
/////////////////////////////////////////////////////////////////////
void G4EzVolume::CreateSphereVolume(G4Material* amaterial,
G4double rmin, G4double rmax,
G4double phi0, G4double dphi,
G4double theta0, G4double dtheta)
/////////////////////////////////////////////////////////////////////
{
if(lv !=0 ) {
G4cout << "%%% Warning (G4EzVolume): volume is already created."
<< G4endl;
return;
}
solid= new G4Sphere(name, rmin, rmax, phi0, dphi, theta0, dtheta);
lv= new G4LogicalVolume(solid, amaterial, name);
// vis. attributes
va= new G4VisAttributes();
lv-> SetVisAttributes(va);
}
//////////////////////////////////////////////////////////////////////
void G4EzVolume::CreateOrbVolume(G4Material* amaterial, G4double rmax)
//////////////////////////////////////////////////////////////////////
{
if(lv !=0 ) {
G4cout << "%%% Warning (G4EzVolume): volume is already created."
<< G4endl;
return;
}
solid= new G4Orb(name, rmax);
lv= new G4LogicalVolume(solid, amaterial, name);
// vis. attributes
va= new G4VisAttributes();
lv-> SetVisAttributes(va);
}
////////////////////////////////////////////////////////////////
G4VPhysicalVolume* G4EzVolume::PlaceIt(const G4ThreeVector& pos,
G4int ncopy,
G4EzVolume* parent)
////////////////////////////////////////////////////////////////
{
if(lv==0) {
G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
<< G4endl;
return 0;
}
G4PVPlacement* pv;
if(parent==0) { // place it in the world
G4VPhysicalVolume* world= G4EzWorld::GetWorldVolume();
pv= new G4PVPlacement(0, pos, name, lv, world, false, ncopy);
} else {
pv= new G4PVPlacement(0, pos, lv, name, parent->lv, false, ncopy);
}
nplacement++;
return pv;
}
//////////////////////////////////////////////////////////////////////
G4VPhysicalVolume* G4EzVolume::PlaceIt(const G4Transform3D& transform,
G4int ncopy,
G4EzVolume* parent)
//////////////////////////////////////////////////////////////////////
{
if(lv==0) {
G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
<< G4endl;
return 0;
}
G4PVPlacement* pv;
if(parent==0) { // place it in the world
G4VPhysicalVolume* world= G4EzWorld::GetWorldVolume();
pv= new G4PVPlacement(transform, name, lv, world, false, ncopy);
} else {
pv= new G4PVPlacement(transform, lv, name, parent->lv, false, ncopy);
}
nplacement++;
return pv;
}
///////////////////////////////////////////////////////////////////////////
G4VPhysicalVolume* G4EzVolume::ReplicateIt(G4EzVolume* parent,
EAxis pAxis, G4int nReplicas,
G4double width, G4double offset)
///////////////////////////////////////////////////////////////////////////
{
if(lv==0) {
G4cout << "%%% Warning (G4EzVolume): volume is not yet created."
<< G4endl;
return 0;
}
G4PVReplica* pv=
new G4PVReplica(name, lv, parent->lv, pAxis, nReplicas, width, offset);
nplacement += nReplicas;
return pv;
}
//////////////////////////////////////////////////////////////////
G4ThreeVector G4EzVolume::VoxelizeIt(G4int nx, G4int ny, G4int nz)
//////////////////////////////////////////////////////////////////
{
// creating voxel volume...
G4Box* avolume= dynamic_cast<G4Box*>(solid);
if(avolume ==0 ) {
G4cout << "%%% Error (G4EzVolume): voxelization is valid "
<< "only for Box geometry." << G4endl;
return G4ThreeVector();
}
if(lvsub !=0) {
G4cout << "%%% Error (G4EzVolume): already voxelized." << G4endl;
return G4ThreeVector();
}
G4double dx= (avolume-> GetXHalfLength())*2.;
G4double dy= (avolume-> GetYHalfLength())*2.;
G4double dz= (avolume-> GetZHalfLength())*2.;
// voxel size
G4double ddx= dx/nx;
G4double ddy= dy/ny;
G4double ddz= dz/nz;
G4Box* voxel= new G4Box("voxel", ddx/2., ddy/2., ddz/2.);
G4Material* voxelMaterial= lv-> GetMaterial();
lvsub= new G4LogicalVolume(voxel, voxelMaterial, "voxel");
G4VisAttributes* vavoxel= new G4VisAttributes(G4Color(1.,0.,0.));
lvsub-> SetVisAttributes(vavoxel);
G4EzVoxelParameterization* voxelParam=
new G4EzVoxelParameterization(ddx, ddy, ddz, nx, ny, nz);
G4int nvoxel= nx*ny*nz;
new G4PVParameterised(name+"_voxel", lvsub, lv, kXAxis,
nvoxel, voxelParam);
return G4ThreeVector(ddx, ddy, ddz);
}
////////////////////////////////////////////////////////////////
void G4EzVolume::SetSensitiveDetector(G4VSensitiveDetector* asd)
////////////////////////////////////////////////////////////////
{
if(lvsub!=0) {
lvsub-> SetSensitiveDetector(asd);
return;
}
if(lv!=0) lv-> SetSensitiveDetector(asd);
}
@@ -0,0 +1,167 @@
//
// ********************************************************************
// * 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: G4EzVolume.hh,v 1.3 2006/06/29 15:28:55 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// G4EzVolume.hh
//
// Utility class for supporting creating user geometry
//
// * wrapper of logical volume
//
// 2005 Q
// ====================================================================
#ifndef G4_EZ_VOLUME_H
#define G4_EZ_VOLUME_H
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4Transform3D.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4Material;
class G4VSolid;
class G4VPhysicalVolume;
class G4EzVolume {
protected:
// volume information
G4String name;
G4VSolid* solid;
G4LogicalVolume* lv;
G4LogicalVolume* lvsub; // logical volume for voxels
G4VisAttributes* va;
G4int nplacement; // # of placements
public:
G4EzVolume();
G4EzVolume(const G4String& aname);
~G4EzVolume();
// createing volume
void CreateBoxVolume(G4Material* amaterial,
G4double dx, G4double dy, G4double dz);
void CreateTubeVolume(G4Material* amaterial,
G4double rmin, G4double rmax,
G4double dz,
G4double phi0=0., G4double dphi=360*deg);
void CreateConeVolume(G4Material* amaterial,
G4double rmin1, G4double rmax1,
G4double rmin2, G4double rmax2,
G4double dz,
G4double phi0=0., G4double dphi=360.*deg);
void CreateSphereVolume(G4Material* amaterial,
G4double rmin, G4double rmax,
G4double phi0=0., G4double dphi=360.*deg,
G4double theta0=0., G4double dtheta=180.*deg);
void CreateOrbVolume(G4Material* amaterial, G4double rmax);
// placement
G4VPhysicalVolume* PlaceIt(const G4ThreeVector& pos, G4int ncopy=0,
G4EzVolume* parent=0);
G4VPhysicalVolume* PlaceIt(const G4Transform3D& transform, G4int ncopy=0,
G4EzVolume* parent=0);
// replica
// parent volume should be exactly filled with replicated volumes.
G4VPhysicalVolume* ReplicateIt(G4EzVolume* parent,
EAxis pAxis, G4int nReplicas,
G4double width, G4double offset=0);
// voxelize
// volume should be "BOX". otherwise, error.
// returning voxel size in each dimension
G4ThreeVector VoxelizeIt(G4int nx, G4int ny, G4int nz);
// sensitivity
// in the case of voxelized, SD will be set to a voxel.
void SetSensitiveDetector(G4VSensitiveDetector* asd);
// direct access to properties
const G4String& GetName() const;
void SetSolid(G4VSolid* asolid);
const G4VSolid* GetSolid() const;
void SetMaterial(G4Material* amaterial);
G4Material* GetMaterial() const;
G4int GetNofPlacements() const;
void SetVisibility(G4bool qvisible);
void SetColor(const G4Color& color);
void SetColor(G4double red, G4double green, G4double blue);
};
// ====================================================================
// inline functions
// ====================================================================
inline const G4String& G4EzVolume::GetName() const { return name; }
inline void G4EzVolume::SetSolid(G4VSolid* asolid) { solid= asolid; }
inline const G4VSolid* G4EzVolume::GetSolid() const { return solid; }
inline void G4EzVolume::SetMaterial(G4Material* amaterial)
{
if(lv!= 0) lv-> SetMaterial(amaterial);
if(lvsub!= 0) lvsub-> SetMaterial(amaterial);
}
inline G4Material* G4EzVolume::GetMaterial() const
{
if(lv!=0) return lv-> GetMaterial();
else return 0;
}
inline G4int G4EzVolume::GetNofPlacements() const { return nplacement; }
inline void G4EzVolume::SetVisibility(G4bool qvisible)
{
if(va!=0) va-> SetVisibility(qvisible);
}
inline void G4EzVolume::SetColor(const G4Color& color)
{
if(va!=0) va-> SetColor(color);
}
inline void G4EzVolume::SetColor(G4double red, G4double green, G4double blue)
{
if(va!=0) va-> SetColor(red, green, blue);
}
#endif
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * 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: G4EzVoxelParameterization.cc,v 1.3 2006/06/29 15:28:58 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// G4EzVoxelParameterization.cc
//
// 2005 Q
// ====================================================================
#include "G4EzVoxelParameterization.hh"
#include "G4Box.hh"
#include "G4VPhysicalVolume.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////////////////////////////////////////////////
G4EzVoxelParameterization::G4EzVoxelParameterization
(G4double ddx, G4double ddy, G4double ddz, G4int nx, G4int ny, G4int nz)
: voxelSize(ddx, ddy, ddz), motherSize(ddx*nx, ddy*ny, ddz*nz)
//////////////////////////////////////////////////////////////////////////
{
nvoxels[0]= nx;
nvoxels[1]= ny;
nvoxels[2]= nz;
}
///////////////////////////////////////////////////////
G4EzVoxelParameterization::~G4EzVoxelParameterization()
///////////////////////////////////////////////////////
{
}
///////////////////////////////////////////////////////////
void G4EzVoxelParameterization::ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume* physVol) const
///////////////////////////////////////////////////////////
{
// copyNo-> index
G4int nxy= nvoxels[0]*nvoxels[1];
G4int iz= copyNo/nxy;
G4int ixy= copyNo - iz*nxy;
G4int iy= ixy/nvoxels[0];
G4int ix= ixy-iy*nvoxels[0];
// voxel position
G4double px= voxelSize[0]*(ix+0.5) - motherSize[0]/2.;
G4double py= voxelSize[1]*(iy+0.5) - motherSize[1]/2.;
G4double pz= voxelSize[2]*(iz+0.5) - motherSize[2]/2.;
physVol-> SetTranslation(G4ThreeVector(px, py, pz));
}
//////////////////////////////////////////////////////////////////////////////
void G4EzVoxelParameterization::ComputeDimensions
(G4Box& aBox, const G4int copyNo, const G4VPhysicalVolume* physVol) const
//////////////////////////////////////////////////////////////////////////////
{
return;
}
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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: G4EzVoxelParameterization.hh,v 1.3 2006/06/29 15:29:01 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// G4EzVoxelParameterization.hh
//
// 2005 Q
// ====================================================================
#ifndef G4EZ_VOXEL_PARAMETERIZATION_H
#define G4EZ_VOXEL_PARAMETERIZATION_H
#include "G4VPVParameterisation.hh"
#include "G4ThreeVector.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4EzVoxelParameterization : public G4VPVParameterisation {
protected:
G4ThreeVector voxelSize;
G4ThreeVector motherSize;
G4int nvoxels[3];
public:
G4EzVoxelParameterization(G4double ddx, G4double ddy, G4double ddz,
G4int nx, G4int ny, G4int nz);
~G4EzVoxelParameterization();
virtual void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume* physVol) const;
virtual void ComputeDimensions(G4Box& aBox, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
};
#endif
@@ -0,0 +1,143 @@
//
// ********************************************************************
// * 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: G4EzWorld.cc,v 1.3 2006/06/29 15:29:04 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// G4EzWorld.cc
//
// 2005 Q
// ====================================================================
#include "G4EzWorld.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4RunManager.hh"
#include "G4Version.hh"
G4VPhysicalVolume* G4EzWorld::world= G4EzWorld::CreateWorld();
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////
G4EzWorld::G4EzWorld()
//////////////////////
{
}
///////////////////////
G4EzWorld::~G4EzWorld()
///////////////////////
{
world= 0;
}
//////////////////////////////////////////////////////////
G4VPhysicalVolume* G4EzWorld::CreateWorld
(G4double dx, G4double dy, G4double dz)
//////////////////////////////////////////////////////////
{
// default matetial is "vacuum"
#if G4VERSION_NUMBER >= 800
G4Material* vacuum= G4Material::GetMaterial("_Vacuum", false);
#else
G4Material* vacuum= G4Material::GetMaterial("_Vacuum");
#endif
if(vacuum==0) {
G4Element* elN= new G4Element("_N", "", 7., 14.00674*g/mole);
G4Element* elO= new G4Element("_O", "", 8., 15.9994*g/mole);
vacuum= new G4Material("_Vacuum", universe_mean_density, 2);
vacuum-> AddElement(elN, 0.7);
vacuum-> AddElement(elO, 0.3);
}
G4Box* sdworld= new G4Box("world", dx/2., dy/2., dz/2.);
G4LogicalVolume* lvworld= new G4LogicalVolume(sdworld, vacuum, "word");
G4PVPlacement* aworld= new G4PVPlacement(0, G4ThreeVector(), "world",
lvworld, 0, false, 0);
// vis. attributes
G4VisAttributes* vaworld= new G4VisAttributes(G4Color(1.,1.,1.));
vaworld-> SetForceWireframe(true);
lvworld-> SetVisAttributes(vaworld);
return aworld;
}
////////////////////////////////////////////////////////////
void G4EzWorld::Reset(G4double dx, G4double dy, G4double dz)
////////////////////////////////////////////////////////////
{
delete world;
world= CreateWorld(dx, dy, dz);
G4RunManager* runManager= G4RunManager::GetRunManager();
runManager-> DefineWorldVolume(world);
}
/////////////////////////////////////////////////////////////
void G4EzWorld::Resize(G4double dx, G4double dy, G4double dz)
/////////////////////////////////////////////////////////////
{
G4Box* box= dynamic_cast<G4Box*>(world-> GetLogicalVolume()-> GetSolid());
box-> SetXHalfLength(dx/2.);
box-> SetYHalfLength(dy/2.);
box-> SetZHalfLength(dz/2.);
G4RunManager* runManager= G4RunManager::GetRunManager();
runManager-> GeometryHasBeenModified();
}
//////////////////////////////////////////////////
void G4EzWorld::SetMaterial(G4Material* amaterial)
//////////////////////////////////////////////////
{
world-> GetLogicalVolume()-> SetMaterial(amaterial);
}
//////////////////////////////////////////
void G4EzWorld::SetVisibility(G4bool qvis)
//////////////////////////////////////////
{
G4VisAttributes* vaworld= const_cast<G4VisAttributes*>(
world-> GetLogicalVolume()-> GetVisAttributes());
vaworld-> SetVisibility(qvis);
}
@@ -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: G4EzWorld.hh,v 1.3 2006/06/29 15:29:07 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// G4EzWorld.hh
//
// Utility class for supporting creating user geometry
//
// management of a world volume
//
// 2005 Q
// ====================================================================
#ifndef G4_EZ_WORLD_H
#define G4_EZ_WORLD_H
#include "globals.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4Material;
class G4VPhysicalVolume;
class G4EzWorld {
protected:
// world volume is automatically presented.
static G4VPhysicalVolume* world;
static G4VPhysicalVolume* CreateWorld(G4double dx=1.*m,
G4double dy=1.*m,
G4double dz=1.*m);
public:
G4EzWorld();
~G4EzWorld();
static G4VPhysicalVolume* GetWorldVolume();
static void Reset(G4double dx, G4double dy, G4double dz);
static void Resize(G4double dx, G4double dy, G4double dz);
static void SetMaterial(G4Material* amaterial);
static void SetVisibility(G4bool qvis);
};
// ====================================================================
// inline functions
// ====================================================================
inline G4VPhysicalVolume* G4EzWorld::GetWorldVolume() { return world; }
#endif
@@ -0,0 +1,17 @@
# $Id: GNUmakefile,v 1.1 2006/04/25 09:00:01 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
include ../../../../config/config.gmk
MODULE := libezgeom#
include $(G4PY_INSTALL)/config/g4py.gmk
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)
@@ -0,0 +1,160 @@
//
// ********************************************************************
// * 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: pyEzgeom.cc,v 1.3 2006/06/29 15:28:49 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyEZgeom.cc
//
// [EZgeom]
// a site-module of Geant4Py
//
// An easy way to build geometry
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "EzDetectorConstruction.hh"
#include "G4EzWorld.hh"
#include "G4EzVolume.hh"
#include "G4RunManager.hh"
#include "G4VSensitiveDetector.hh"
using namespace boost::python;
// ====================================================================
// thin wrappers
// ====================================================================
namespace pyEZgeom {
// methods in global namespace
void Construct()
{
G4RunManager* runMgr= G4RunManager::GetRunManager();
runMgr-> SetUserInitialization(new EzDetectorConstruction);
}
void ResetWorld(G4double dx, G4double dy, G4double dz)
{
G4EzWorld::Reset(dx, dy, dz);
}
void ResizeWorld(G4double dx, G4double dy, G4double dz)
{
G4EzWorld::Resize(dx, dy, dz);
}
void SetWorldMaterial(G4Material* amaterial)
{
G4EzWorld::SetMaterial(amaterial);
}
void SetWorldVisibility(G4bool qvis)
{
G4EzWorld::SetVisibility(qvis);
}
// CreateTubeVolume
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateTubeVolume,
CreateTubeVolume, 4, 6);
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateConeVolume,
CreateConeVolume, 6, 8);
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateSphereVolume,
CreateSphereVolume, 3, 7);
// PlaceIt
G4VPhysicalVolume*(G4EzVolume::*f1_PlaceIt)
(const G4ThreeVector&, G4int, G4EzVolume*) = &G4EzVolume::PlaceIt;
G4VPhysicalVolume*(G4EzVolume::*f2_PlaceIt)
(const G4Transform3D&, G4int, G4EzVolume*) = &G4EzVolume::PlaceIt;
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_PlaceIt, PlaceIt, 1, 3);
// ReplicateIt
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_ReplicateIt, ReplicateIt, 4, 5);
// SetColor
void (G4EzVolume::*f1_SetColor)(const G4Color&) = &G4EzVolume::SetColor;
void (G4EzVolume::*f2_SetColor)(G4double, G4double, G4double)
= &G4EzVolume::SetColor;
};
using namespace pyEZgeom;
// ====================================================================
// Expose to Python
// ====================================================================
BOOST_PYTHON_MODULE(EZgeom) {
class_<G4EzVolume>("G4EzVolume", "an easy way of geometry configuration")
.def(init<const G4String&>())
// ---
.def("CreateBoxVolume", &G4EzVolume::CreateBoxVolume)
.def("CreateTubeVolume", &G4EzVolume::CreateTubeVolume,
f_CreateTubeVolume())
.def("CreateConeVolume", &G4EzVolume::CreateConeVolume,
f_CreateConeVolume())
.def("CreateShpereVolume", &G4EzVolume::CreateSphereVolume,
f_CreateSphereVolume())
.def("CreateOrbVolume", &G4EzVolume::CreateOrbVolume)
// ---
.def("SetSold", &G4EzVolume::SetSolid)
.def("GetSold", &G4EzVolume::GetSolid,
return_value_policy<reference_existing_object>())
.def("SetMaterial", &G4EzVolume::SetMaterial)
.def("GetMaterial", &G4EzVolume::GetMaterial,
return_value_policy<reference_existing_object>())
// ---
.def("PlaceIt", f1_PlaceIt,
f_PlaceIt()[return_value_policy<reference_existing_object>()])
.def("PlaceIt", f2_PlaceIt,
f_PlaceIt()[return_value_policy<reference_existing_object>()])
.def("ReplicateIt", &G4EzVolume::ReplicateIt,
f_ReplicateIt()[return_value_policy<reference_existing_object>()])
.def("VoxelizeIt", &G4EzVolume::VoxelizeIt)
// ---
.def("SetSensitiveDetector", &G4EzVolume::SetSensitiveDetector)
// ---
.def("SetColor", f1_SetColor)
.def("SetColor", f2_SetColor)
.def("SetVisibility", &G4EzVolume::SetVisibility)
;
// -------------------------------------------------------------------
def("Construct", Construct);
def("ResetWorld", ResetWorld);
def("ResizeWorld", ResizeWorld);
def("SetWorldMaterial", SetWorldMaterial);
def("SetWorldVisibility", SetWorldVisibility);
}
@@ -0,0 +1,24 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:17:30 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
#SUBDIR := EZdetector EZgeom python
SUBDIR := python
SUBDIR2 := EZgeom
.PHONY: all install clean cleanlib
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) installall); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) cleanall); done;:
@@ -0,0 +1,29 @@
# $Id: GNUmakefile,v 1.3 2006/06/14 08:23:52 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
install_dir := $(Q_LIBDIR)/EZsim
pys := $(wildcard *.py)
pycs := $(patsubst %.py, %.pyc, $(pys))
pyos := $(patsubst %.py, %.pyo, $(pys))
.PHONY: clean
all: $(pycs) $(pyos)
install: $(pycs) $(pyos)
@echo ... intall "*.py" into $(install_dir)
@if [ ! -d $(install_dir) ]; then install -d $(install_dir); fi
@install -m 755 $(pys) $(pycs) $(pyos) $(install_dir)
clean:
@-\rm -f $(pycs) $(pyos)
@@ -0,0 +1,20 @@
# $Id: __init__.py,v 1.1 2006/02/27 09:46:31 kmura Exp $
"""
# ==================================================================
# [EZsim]
# a site-module of Geant4Py
#
# A package for easy simulation
#
# ==================================================================
"""
# ==================================================================
# import submodules
# ==================================================================
import EZgeom
#import EZdetector
# ==================================================================
# globals, which start with "g"
# ==================================================================
@@ -0,0 +1,26 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:18:58 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
include ../config/config.gmk
SUBDIR := geometries materials physics_lists primaries
SUBDIR += EZsim
.PHONY: all install clean uninstall
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
install:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) install); done;:
clean:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE) clean); done;:
uninstall:
@-\rm -f -r $(Q_LIBDIR)/site-modules
@-\rm -f $(Q_LIBDIR)/lib*.so
@@ -0,0 +1,157 @@
//
// ********************************************************************
// * 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: ExN01DetectorConstruction.cc,v 1.4 2006/06/29 15:29:10 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// ExN01DetectorConstruction.cc
//
// 2005 Q
// ====================================================================
#include "ExN01DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////////////////////////////
ExN01DetectorConstruction::ExN01DetectorConstruction()
: experimentalHall_log(0), tracker_log(0),
calorimeterBlock_log(0), calorimeterLayer_log(0),
experimentalHall_phys(0), calorimeterLayer_phys(0),
calorimeterBlock_phys(0), tracker_phys(0)
//////////////////////////////////////////////////////
{
}
///////////////////////////////////////////////////////
ExN01DetectorConstruction::~ExN01DetectorConstruction()
///////////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////////////
G4VPhysicalVolume* ExN01DetectorConstruction::Construct()
/////////////////////////////////////////////////////////
{
//------------------------------------------------------ materials
G4double a; // atomic mass
G4double z; // atomic number
G4double density;
G4Material* Ar =
new G4Material("ArgonGas", z= 18., a= 39.95*g/mole, density= 1.782*mg/cm3);
G4Material* Al =
new G4Material("Aluminum", z= 13., a= 26.98*g/mole, density= 2.7*g/cm3);
G4Material* Pb =
new G4Material("Lead", z= 82., a= 207.19*g/mole, density= 11.35*g/cm3);
//------------------------------------------------------ volumes
//------------------------------ experimental hall (world volume)
//------------------------------ beam line along x axis
G4double expHall_x = 3.0*m;
G4double expHall_y = 1.0*m;
G4double expHall_z = 1.0*m;
G4Box* experimentalHall_box
= new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
experimentalHall_log = new G4LogicalVolume(experimentalHall_box,
Ar,"expHall_log",0,0,0);
experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),
experimentalHall_log,
"expHall",0,false,0);
//------------------------------ a tracker tube
G4double innerRadiusOfTheTube = 0.*cm;
G4double outerRadiusOfTheTube = 60.*cm;
G4double hightOfTheTube = 50.*cm;
G4double startAngleOfTheTube = 0.*deg;
G4double spanningAngleOfTheTube = 360.*deg;
G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube,
outerRadiusOfTheTube,hightOfTheTube,
startAngleOfTheTube,
spanningAngleOfTheTube);
tracker_log = new G4LogicalVolume(tracker_tube,Al,"tracker_log",0,0,0);
G4double trackerPos_x = -1.0*m;
G4double trackerPos_y = 0.*m;
G4double trackerPos_z = 0.*m;
tracker_phys = new G4PVPlacement(0,
G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z),
tracker_log,"tracker",experimentalHall_log,false,0);
//------------------------------ a calorimeter block
G4double block_x = 1.0*m;
G4double block_y = 50.0*cm;
G4double block_z = 50.0*cm;
G4Box* calorimeterBlock_box = new G4Box("calBlock_box",block_x,
block_y,block_z);
calorimeterBlock_log = new G4LogicalVolume(calorimeterBlock_box,
Pb,"caloBlock_log",0,0,0);
G4double blockPos_x = 1.0*m;
G4double blockPos_y = 0.0*m;
G4double blockPos_z = 0.0*m;
calorimeterBlock_phys = new G4PVPlacement(0,
G4ThreeVector(blockPos_x,blockPos_y,blockPos_z),
calorimeterBlock_log,"caloBlock",experimentalHall_log,false,0);
//------------------------------ calorimeter layers
G4double calo_x = 1.*cm;
G4double calo_y = 40.*cm;
G4double calo_z = 40.*cm;
G4Box* calorimeterLayer_box = new G4Box("caloLayer_box",
calo_x,calo_y,calo_z);
calorimeterLayer_log = new G4LogicalVolume(calorimeterLayer_box,
Al,"caloLayer_log",0,0,0);
for(G4int i=0;i<19;i++) // loop for 19 layers
{
G4double caloPos_x = (i-9)*10.*cm;
G4double caloPos_y = 0.0*m;
G4double caloPos_z = 0.0*m;
calorimeterLayer_phys = new G4PVPlacement(0,
G4ThreeVector(caloPos_x,caloPos_y,caloPos_z),
calorimeterLayer_log,"caloLayer",calorimeterBlock_log,false,i);
}
//------------------------------------------------------------------
return experimentalHall_phys;
}
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * 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: ExN01DetectorConstruction.hh,v 1.4 2006/06/29 15:29:12 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// ExN01DetectorConstruction.hh
//
// 2005 Q
// ====================================================================
#ifndef EXN01_DETECTOR_CONSTRUCTION_H
#define EXN01_DETECTOR_CONSTRUCTION_H
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4LogicalVolume;
class G4VPhysicalVolume;
#include "G4VUserDetectorConstruction.hh"
class ExN01DetectorConstruction : public G4VUserDetectorConstruction {
public:
ExN01DetectorConstruction();
~ExN01DetectorConstruction();
G4VPhysicalVolume* Construct();
private:
// Logical volumes
//
G4LogicalVolume* experimentalHall_log;
G4LogicalVolume* tracker_log;
G4LogicalVolume* calorimeterBlock_log;
G4LogicalVolume* calorimeterLayer_log;
// Physical volumes
//
G4VPhysicalVolume* experimentalHall_phys;
G4VPhysicalVolume* calorimeterLayer_phys;
G4VPhysicalVolume* calorimeterBlock_phys;
G4VPhysicalVolume* tracker_phys;
};
#endif

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