Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
@@ -1,41 +0,0 @@
# $Id: GNUmakefile,v 1.3 2006/08/10 08:50:18 kmura Exp $
# $Name: geant4-09-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#
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
@@ -1,17 +0,0 @@
# $Id: GNUmakefile,v 1.2 2006/08/08 05:26:19 kmura Exp $
# $Name: geant4-09-01 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
include ../../../../config/config.gmk
LIBRARY := 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 $(LIBRARY).$(soext) $(Q_LIBDIR)
@@ -1,29 +0,0 @@
# $Id: GNUmakefile,v 1.3 2006/06/14 08:23:52 kmura Exp $
# $Name: geant4-09-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)
@@ -1,20 +0,0 @@
# $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"
# ==================================================================
+5 -10
View File
@@ -1,14 +1,14 @@
# $Id: GNUmakefile,v 1.3 2006/07/12 01:56:23 kmura Exp $
# $Name: geant4-09-01 $
# $Id: GNUmakefile,v 1.4 2008/12/01 07:23:29 kmura Exp $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
include ../config/config.gmk
SUBDIR := geometries materials physics_lists primaries utils
SUBDIR += EZsim
SUBDIR := geometries materials processes physics_lists primaries
SUBDIR += utils python
.PHONY: all install clean uninstall
.PHONY: all install clean
all:
@for dir in $(SUBDIR); do (cd $$dir && $(MAKE)); done;:
@@ -19,8 +19,3 @@ install:
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
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ExN01DetectorConstruction.cc,v 1.4 2006/06/29 15:29:10 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// ExN01DetectorConstruction.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ExN01DetectorConstruction.hh,v 1.4 2006/06/29 15:29:12 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// ExN01DetectorConstruction.hh
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:25:12 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyExN01geom.cc,v 1.4 2006/06/29 15:29:14 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyExN01geom.cc
//
@@ -25,7 +25,7 @@
//
//
// $Id: ExN03DetectorConstruction.cc,v 1.5 2006/12/01 02:37:01 kmura Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
@@ -25,7 +25,7 @@
//
//
// $Id: ExN03DetectorConstruction.hh,v 1.5 2006/12/01 02:37:01 kmura Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
@@ -25,7 +25,7 @@
//
//
// $Id: ExN03DetectorMessenger.cc,v 1.1 2006/12/01 02:37:01 kmura Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
@@ -25,7 +25,7 @@
//
//
// $Id: ExN03DetectorMessenger.hh,v 1.1 2006/12/01 02:37:01 kmura Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:25:12 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyExN03geom.cc,v 1.4 2006/06/29 15:29:21 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyExN03geom.cc
//
@@ -1,10 +1,10 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:25:12 kmura Exp $
# $Name: geant4-09-01 $
# $Id: GNUmakefile,v 1.3 2008/12/01 07:07:05 kmura Exp $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
SUBDIR := Qgeom ExN01geom ExN03geom
SUBDIR := Qgeom ExN01geom ExN03geom ezgeom
.PHONY: all install clean cleanlib
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:25:12 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: QDetectorConstruction.cc,v 1.4 2006/06/29 15:29:24 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// QDetectorConstruction.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: QDetectorConstruction.hh,v 1.4 2006/06/29 15:29:26 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// QDetectorConstruction.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyQgeom.cc,v 1.4 2006/06/29 15:29:29 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyQgeom.cc
//
@@ -23,8 +23,8 @@
// * 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-09-01 $
// $Id: EzDetectorConstruction.cc,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// EzDetectorConstruction.cc
//
@@ -23,8 +23,8 @@
// * 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-09-01 $
// $Id: EzDetectorConstruction.hh,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// EzDetectorConstruction.hh
//
@@ -23,8 +23,8 @@
// * 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-09-01 $
// $Id: G4EzVolume.cc,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// G4EzVolume.cc
//
@@ -23,8 +23,8 @@
// * 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-09-01 $
// $Id: G4EzVolume.hh,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// G4EzVolume.hh
//
@@ -23,8 +23,8 @@
// * 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-09-01 $
// $Id: G4EzVoxelParameterization.cc,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// G4EzVoxelParameterization.cc
//
@@ -23,8 +23,8 @@
// * 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-09-01 $
// $Id: G4EzVoxelParameterization.hh,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// G4EzVoxelParameterization.hh
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EzWorld.cc,v 1.4 2006/08/25 05:13:16 kmura Exp $
// $Name: geant4-09-01 $
// $Id: G4EzWorld.cc,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// G4EzWorld.cc
//
@@ -38,7 +38,6 @@
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4RunManager.hh"
#include "pyG4Version.hh"
G4VPhysicalVolume* G4EzWorld::world= G4EzWorld::CreateWorld();
@@ -68,11 +67,7 @@ G4VPhysicalVolume* G4EzWorld::CreateWorld
//////////////////////////////////////////////////////////
{
// 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);
@@ -23,8 +23,8 @@
// * 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-09-01 $
// $Id: G4EzWorld.hh,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// G4EzWorld.hh
//
@@ -0,0 +1,14 @@
# $Id: GNUmakefile,v 1.1 2008/12/01 07:07:34 kmura Exp $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
# python module name
MODULE := ezgeom#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
include $(G4PY_INSTALL)/config/site-install.gmk
@@ -23,12 +23,12 @@
// * 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-09-01 $
// $Id: pyEzgeom.cc,v 1.1 2008/12/01 07:07:34 kmura Exp $
// $Name: geant4-09-02 $
// ====================================================================
// pyEZgeom.cc
//
// [EZgeom]
// [ezgeom]
// a site-module of Geant4Py
//
// An easy way to build geometry
@@ -114,7 +114,7 @@ using namespace pyEZgeom;
// Expose to Python
// ====================================================================
BOOST_PYTHON_MODULE(EZgeom) {
BOOST_PYTHON_MODULE(ezgeom) {
class_<G4EzVolume>("G4EzVolume", "an easy way of geometry configuration")
.def(init<const G4String&>())
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:28:34 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:28:34 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: NISTmaterials.cc,v 1.4 2006/06/29 15:29:32 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// NISTmaterials.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyNISTmaterials.cc,v 1.4 2006/06/29 15:29:34 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyNISTmaterials.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:28:36 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: Qmaterials.cc,v 1.4 2006/06/29 15:29:37 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// Qmaterials.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyQmaterials.cc,v 1.4 2006/06/29 15:29:40 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyQmaterials.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.1 2006/07/12 08:46:18 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PhysicsListEMlowE.cc,v 1.1 2006/07/12 08:46:18 kmura Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// PhysicsListEMlowE.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PhysicsListEMlowE.hh,v 1.1 2006/07/12 08:46:18 kmura Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// PhysicsListEMlowE.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyEMLowEpl.cc,v 1.2 2006/07/12 09:18:08 kmura Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyEMLowEpl.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:31:40 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PhysicsListEMstd.cc,v 1.5 2006/07/11 09:55:01 kmura Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// PhysicsListEMstd.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: PhysicsListEMstd.hh,v 1.4 2006/06/29 15:29:46 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// PhysicsListEMstd.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyEMSTDpl.cc,v 1.4 2006/06/29 15:29:49 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyEMSTDpl.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ExN01PhysicsList.cc,v 1.4 2006/06/29 15:29:52 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// ExN01PhysicsList.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ExN01PhysicsList.hh,v 1.4 2006/06/29 15:29:55 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// ExN01PhysicsList.hh
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:31:40 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyExN01pl.cc,v 1.4 2006/06/29 15:29:58 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyExN01pl.cc
//
@@ -25,7 +25,7 @@
//
//
// $Id: ExN03PhysicsList.cc,v 1.4 2006/06/29 15:30:01 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
@@ -25,7 +25,7 @@
//
//
// $Id: ExN03PhysicsList.hh,v 1.4 2006/06/29 15:30:04 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.1 2006/04/25 10:32:41 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyExN03pl.cc,v 1.3 2006/06/29 15:30:07 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyExN03pl.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.3 2006/07/12 08:45:14 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:29:52 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:29:52 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: MedicalBeam.cc,v 1.6 2006/06/29 15:30:10 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// MedicalBeam.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: MedicalBeam.hh,v 1.4 2006/06/29 15:30:12 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// MedicalBeam.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyMedicalBeam.cc,v 1.4 2006/06/29 15:30:14 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyMedicalBeam.cc
//
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:29:52 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ParticleGunAction.cc,v 1.4 2006/06/29 15:30:16 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// ParticleGunAction.cc
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: ParticleGunAction.hh,v 1.4 2006/06/29 15:30:19 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// ParticleGunAction.hh
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: pyParticleGun.cc,v 1.4 2006/06/29 15:30:21 gunter Exp $
// $Name: geant4-09-01 $
// $Name: geant4-09-02 $
// ====================================================================
// pyParticleGun.cc
//
@@ -1,24 +1,19 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 10:17:30 kmura Exp $
# $Name: geant4-09-01 $
# $Id: GNUmakefile,v 1.1 2008/12/01 07:04:08 kmura Exp $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
#SUBDIR := EZdetector EZgeom python
SUBDIR := python
SUBDIR2 := EZgeom
SUBDIR := emcalculator
.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,13 @@
# $Id: GNUmakefile,v 1.2 2008/12/03 07:40:49 kmura Exp $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
install_dir := $(Q_LIBDIR)/g4py
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
include $(G4PY_INSTALL)/config/script-install.gmk
@@ -0,0 +1,150 @@
#$Id: emcalculator.py,v 1.1 2008/12/01 07:04:08 kmura Exp $
"""
# ==================================================================
# Python module
#
# Calculation of photon cross section and stopping power for
# chared particles
#
# Q, 2005
# ==================================================================
"""
from Geant4 import *
# ==================================================================
# public symbols
# ==================================================================
__all__ = [ 'CalculatePhotonCrossSection', 'CalculateDEDX' ]
# ==================================================================
# Photon Cross Section
# ==================================================================
def CalculatePhotonCrossSection(mat, elist, verbose=0,
plist=["compt", "", "phot", "conv"]):
"""
Calculate photon cross section for a given material and
a list of energy, returing a list of cross sections for
the components of "Copmton scattering", "rayleigh scattering",
"photoelectric effect", "pair creation" and total one.
Arguments:
mat: material name
elist: list of energy
verbose: verbose level [0]
plist: list of process name
(compton/rayleigh/photoelectic/conversion) [StandardEM set]
Keys of index:
"compt": Compton Scattering
"rayleigh": Rayleigh Scattering
"phot" : photoelectric effect
"conv" : pair Creation
"tot" : total
Example:
xsec_list= CalculatePhotonCrossSection(...)
value= xsec_list[energy_index]["compt"]
"""
if(verbose>0):
print "-------------------------------------------------------------------"
print " Photon Cross Section (", mat, ")"
print "Energy Compton Raleigh Photo- Pair Total"
print " Scattering Scattering electric Creation"
print "(MeV) (cm2/g) (cm2/g) (cm2/g) (cm2/g) (cm2/g)"
print "-------------------------------------------------------------------"
xsection_list= []
for ekin in elist:
xsec= {}
xsec["compt"] \
= gEmCalculator.ComputeCrossSectionPerVolume(ekin, "gamma", plist[0],
mat) * cm2/g
xsec["rayleigh"] \
= gEmCalculator.ComputeCrossSectionPerVolume(ekin, "gamma", plist[1],
mat) * cm2/g
xsec["phot"] \
= gEmCalculator.ComputeCrossSectionPerVolume(ekin, "gamma", plist[2],
mat) * cm2/g
xsec["conv"] \
= gEmCalculator.ComputeCrossSectionPerVolume(ekin, "gamma", plist[3],
mat) * cm2/g
xsec["tot"]= xsec["compt"] + xsec["rayleigh"] + xsec["phot"] + xsec["conv"]
xsection_list.append((ekin, xsec))
if(verbose>0):
print " %8.3e %8.3e %8.3e %8.3e %8.3e %8.3e" \
% (ekin/MeV, xsec["compt"]/(cm2/g), xsec["rayleigh"]/(cm2/g),
xsec["phot"]/(cm2/g), xsec["conv"]/(cm2/g), xsec["tot"]/(cm2/g))
return xsection_list
# ==================================================================
# Stopping Power
# ==================================================================
def CalculateDEDX(part, mat, elist, verbose=0,
plist=["eIoni", "eBrem", "muIoni", "muBrems", "hIoni"]):
"""
Calculate stopping powers for a give particle, material and
a list of energy, returing stopping power for the components of
"Ionization", "Radiation" and total one.
Arguments:
part: particle name
mat: material name
elist: list of energy
verbose: verbose level [0]
plist: list of process name
(electron ionization/electron brems/
muon ionization/muon brems/hadron ionization) [StandardEM set]
Keys of index:
"ioni": ionization
"brems": Bremsstrahlung
"tot": total
Example:
dedx_list= CalculateDEDX(...)
value= dedx_list[energy_index]["ioni"]
"""
if(verbose>0):
print "------------------------------------------------------"
print " Stopping Power (", part, ",", mat, ")"
print " Energy Ionization Radiation Total"
print " (MeV) (MeVcm2/g) (MeVcm2/g) (MeVcm2/g)"
print "------------------------------------------------------"
procname_brems= ""
procname_ioni= ""
if ( part=="e+" or part=="e-" ):
procname_ioni= plist[0]
procname_brems= plist[1]
elif ( part=="mu+" or part=="mu-"):
procname_ioni= plist[2]
procname_brems= plist[3]
else:
procname_ioni= plist[4]
procname_brems= ""
dedx_list= []
for ekin in elist:
dedx= {}
dedx["ioni"] \
= gEmCalculator.ComputeDEDX(ekin, part, procname_ioni, mat) * MeV*cm2/g
dedx["brems"] \
= gEmCalculator.ComputeDEDX(ekin, part, procname_brems, mat) * MeV*cm2/g
dedx["tot"]= dedx["ioni"]+ dedx["brems"]
if(verbose>0):
print " %8.3e %8.3e %8.3e %8.3e" \
% (ekin/MeV, dedx["ioni"]/(MeV*cm2/g),
dedx["brems"]/(MeV*cm2/g), dedx["tot"]/(MeV*cm2/g) )
dedx_list.append((ekin, dedx))
return dedx_list
@@ -0,0 +1,13 @@
# $Id: GNUmakefile,v 1.2 2008/12/03 07:40:49 kmura Exp $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../config/config.gmk
install_dir := $(Q_LIBDIR)/g4py
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
include $(G4PY_INSTALL)/config/script-install.gmk
@@ -0,0 +1,4 @@
# $Id: __init__.py,v 1.1 2008/12/01 07:02:47 kmura Exp $
# Geant4Py site-modules
@@ -1,5 +1,5 @@
# $Id: GNUmakefile,v 1.1 2006/07/12 01:57:46 kmura Exp $
# $Name: geant4-09-01 $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py site-modules
# ===========================================================
@@ -1,29 +1,13 @@
# $Id: GNUmakefile,v 1.1 2006/07/12 02:01:07 kmura Exp $
# $Name: geant4-09-01 $
# $Id: GNUmakefile,v 1.3 2008/12/03 07:40:49 kmura Exp $
# $Name: geant4-09-02 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../config/config.gmk
install_dir := $(Q_LIBDIR)/g4py
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/sys/$(Q_SYSTEM).gmk
install_dir := $(Q_LIBDIR)
pys := $(wildcard *.py)
pycs := $(patsubst %.py, %.pyc, $(pys))
pyos := $(patsubst %.py, %.pyo, $(pys))
.PHONY: clean
all: $(pycs) $(pyos)
install: $(pycs) $(pyos)
@echo ... intall "*.py" into $(install_dir)
@if [ ! -d $(install_dir) ]; then install -d $(install_dir); fi
@install -m 644 $(pys) $(pycs) $(pyos) $(install_dir)
clean:
@-\rm -f $(pycs) $(pyos)
include $(G4PY_INSTALL)/config/script-install.gmk
@@ -1,4 +1,3 @@
# ==================================================================
"""
Python module
@@ -10,9 +9,14 @@ This module provides classes and functions for scoring reactions
Q, 2006
"""
# ==================================================================
from Geant4.HEPUnit import *
import string
from Geant4.hepunit import *
# ==================================================================
# public symbols
# ==================================================================
__all__ = [ 'MCParticle', 'MCVertex', 'read_next_vertex' ]
# ==================================================================
# class definition
@@ -24,13 +28,13 @@ import string
class MCParticle:
"MC particle"
def __init__(self, aname, aZ, aA, akE, apx, apy, apz):
self.name= aname
self.Z= aZ
self.A= aA
self.kineticE= akE
self.px= apx
self.py= apy
self.pz= apz
self.name = aname
self.Z = aZ
self.A = aA
self.kineticE = akE
self.px = apx
self.py = apy
self.pz = apz
def printout(self):
print "--- particle: %s, Z=%2d, A=%2d, kE=%g" % \
@@ -41,13 +45,12 @@ class MCParticle:
# ------------------------------------------------------------------
class MCVertex :
"MC vertex"
def __init__(self, ax, ay, az):
self.x= ax
self.y= ay
self.z= az
self.nparticle= 0
self.particle_list= []
self.x = ax
self.y = ay
self.z = az
self.nparticle = 0
self.particle_list = []
def append_particle(self, aparticle):
self.particle_list.append(aparticle)
@@ -60,73 +63,74 @@ class MCVertex :
p.printout()
def dump_vertex(self, stream):
aline= "%g %g %g %d\n" % \
(self.x/m, self.y/m, self.z/m, self.nparticle)
aline = "%g %g %g %d\n" % \
(self.x/m, self.y/m, self.z/m, self.nparticle)
stream.write(aline)
for p in self.particle_list:
aline= " %s %d %d %g %g %g %g\n" % \
(p.name, p.Z, p.A, p.kineticE/MeV, p.px/MeV, p.py/MeV, p.pz/MeV)
aline = " %s %d %d %g %g %g %g\n" % \
(p.name, p.Z, p.A, p.kineticE/MeV, p.px/MeV, p.py/MeV, p.pz/MeV)
stream.write(aline)
def __del__(self):
np= len(self.particle_list)
np = len(self.particle_list)
del self.particle_list[0:np]
# ==================================================================
# I/O interface
# ==================================================================
# ------------------------------------------------------------------
def read_next_vertex(stream):
# ------------------------------------------------------------------
"read next vertex from a file stream"
line= stream.readline()
if (line == "") : # EOF
if line == "": # EOF
return 0
# reading vertex
data= line.split()
x= string.atof(data[0])*m
y= string.atof(data[1])*m
z= string.atof(data[2])*m
nsec= string.atoi(data[3])
data = line.split()
x = string.atof(data[0]) * m
y = string.atof(data[1]) * m
z = string.atof(data[2]) * m
nsec = string.atoi(data[3])
vertex= MCVertex(x,y,z)
vertex = MCVertex(x,y,z)
# reading particles
for p in range(0, nsec):
data= stream.readline().split()
pname= data[0]
Z= string.atoi(data[1])
A= string.atoi(data[2])
kE= string.atof(data[3])*MeV
px= string.atof(data[4])*MeV
py= string.atof(data[5])*MeV
pz= string.atof(data[6])*MeV
data = stream.readline().split()
pname = data[0]
Z = string.atoi(data[1])
A = string.atoi(data[2])
kE = string.atof(data[3]) * MeV
px = string.atof(data[4]) * MeV
py = string.atof(data[5]) * MeV
pz = string.atof(data[6]) * MeV
particle= MCParticle(pname, Z, A, kE, px, py, pz)
particle = MCParticle(pname, Z, A, kE, px, py, pz)
vertex.append_particle(particle)
return vertex
# ==================================================================
# test
# ==================================================================
def test():
f= open("reaction.dat")
f = open("reaction.dat")
f.seek(0)
while(1):
vertex= read_next_vertex(f)
if(vertex==0):
vertex = read_next_vertex(f)
if vertex == 0:
break
vertex.printout()
del vertex
f.close()
print ">>> EOF"
# ==================================================================
# main
# ==================================================================
if (__name__ == "__main__") :
if __name__ == "__main__":
test()
@@ -1,4 +1,3 @@
# ==================================================================
"""
Python module
@@ -9,16 +8,17 @@ This module provides ROOT IO interface for MCScore data
Q, 2006
"""
# ==================================================================
from Geant4.HEPUnit import *
from array import array
import string
import MCScore
from Geant4.hepunit import *
import mcscore
import ROOT
# ==================================================================
from Geant4.HEPUnit import *
import string
# public symbols
# ==================================================================
__all__ = [ 'MCScoreROOTIO', 'loop_tree' ]
# ==================================================================
# class definition
@@ -29,133 +29,133 @@ import string
class MCScoreROOTIO:
"ROOT IO interface for MCScore"
def __init__(self, bsize=250):
self.maxparticle= bsize # buffer size for #particles/vertex
self.maxparticle = bsize # buffer size for #particles/vertex
# ------------------------------------------------------------------
def define_tree(self):
"define ROOT tree"
# ------------------------------------------------------------------
# defining tree header...
self.vtree= ROOT.TTree('vertex', 'mc vertex')
self.ptree= ROOT.TTree('particle', 'mc particle')
self.vtree = ROOT.TTree('vertex', 'mc vertex')
self.ptree = ROOT.TTree('particle', 'mc particle')
# vertex...
self.a_x= array('d', [0.]); self.vtree.Branch('x', self.a_x, 'x/d')
self.a_y= array('d', [0.]); self.vtree.Branch('y', self.a_y, 'y/d')
self.a_z= array('d', [0.]); self.vtree.Branch('z', self.a_z, 'z/d')
self.a_x = array('d', [0.]); self.vtree.Branch('x', self.a_x, 'x/d')
self.a_y = array('d', [0.]); self.vtree.Branch('y', self.a_y, 'y/d')
self.a_z = array('d', [0.]); self.vtree.Branch('z', self.a_z, 'z/d')
#global a_np, a_namelist, a_Z, a_A, a_ke, a_px, a_py, a_pz
self.a_np= array('i', [0]); self.ptree.Branch('np', self.a_np, 'np/i')
self.a_np = array('i', [0]); self.ptree.Branch('np', self.a_np, 'np/i')
self.a_namelist= array('c', self.maxparticle*10*['\0'])
self.a_namelist = array('c', self.maxparticle*10*['\0'])
# 10 characters/particle
self.ptree.Branch('namelist', self.a_namelist, 'namelist/C')
self.a_Z= array('i', self.maxparticle*[0])
self.a_Z = array('i', self.maxparticle*[0])
self.ptree.Branch('Z', self.a_Z, 'Z[np]/I')
self.a_A= array('i', self.maxparticle*[0])
self.a_A = array('i', self.maxparticle*[0])
self.ptree.Branch('A', self.a_A, 'A[np]/i')
self.a_ke= array('d', self.maxparticle*[0.])
self.a_ke = array('d', self.maxparticle*[0.])
self.ptree.Branch('kE', self.a_ke, 'kE[np]/d')
self.a_px= array('d', self.maxparticle*[0.])
self.a_px = array('d', self.maxparticle*[0.])
self.ptree.Branch('px', self.a_px, 'px[np]/d')
self.a_py= array('d', self.maxparticle*[0.])
self.a_py = array('d', self.maxparticle*[0.])
self.ptree.Branch('py', self.a_py, 'py[np]/d')
self.a_pz= array('d', self.maxparticle*[0.])
self.a_pz = array('d', self.maxparticle*[0.])
self.ptree.Branch('pz', self.a_pz, 'pz[np]/d')
# ------------------------------------------------------------------
def fill_tree(self, vertex):
"fill vertex information to ROOT tree"
# ------------------------------------------------------------------
# ------------------------------------------------------------------
def push_pname(i0, pname): # local function
n= len(pname)
n = len(pname)
for i in xrange(n):
self.a_namelist[i0+i]= pname[i]
self.a_namelist[i0+n]= ' '
self.a_namelist[i0+i] = pname[i]
self.a_namelist[i0+n] = ' '
self.a_x[0]= vertex.x
self.a_y[0]= vertex.y
self.a_z[0]= vertex.z
self.a_x[0] = vertex.x
self.a_y[0] = vertex.y
self.a_z[0] = vertex.z
self.vtree.Fill()
if(vertex.nparticle > self.maxparticle):
if vertex.nparticle > self.maxparticle:
raise """
*** buffer overflow in #particles/vertex.
*** please increment buffersize in MCScoreROOTIO(bsize).
""", self.maxparticle
idx_namelist=0
self.a_np[0]= vertex.nparticle
idx_namelist = 0
self.a_np[0] = vertex.nparticle
for ip in range(vertex.nparticle):
particle= vertex.particle_list[ip]
particle = vertex.particle_list[ip]
push_pname(idx_namelist, particle.name)
idx_namelist+= (len(particle.name)+1)
self.a_Z[ip]= particle.Z
self.a_A[ip]= particle.A
self.a_ke[ip]= particle.kineticE
self.a_px[ip]= particle.px
self.a_py[ip]= particle.py
self.a_pz[ip]= particle.pz
idx_namelist += (len(particle.name)+1)
self.a_Z[ip] = particle.Z
self.a_A[ip] = particle.A
self.a_ke[ip] = particle.kineticE
self.a_px[ip] = particle.px
self.a_py[ip] = particle.py
self.a_pz[ip] = particle.pz
self.a_namelist[idx_namelist]= '\0'
self.a_namelist[idx_namelist] = '\0'
self.ptree.Fill()
# ==================================================================
# functions
# ==================================================================
def loop_tree(tfile, analyze_vertex):
"""
loop ROOT tree in a ROOT file.
* analyze_vertex: user function : analyze_vertex(MCVertex)
"""
# ==================================================================
avtree= tfile.Get("vertex")
aptree= tfile.Get("particle")
avtree = tfile.Get("vertex")
aptree = tfile.Get("particle")
# reading vertex...
n_vertex= avtree.GetEntries()
n_vertex = avtree.GetEntries()
for ivtx in xrange(n_vertex):
avtree.GetEntry(ivtx)
aptree.GetEntry(ivtx)
# vertex
vertex= MCScore.MCVertex(avtree.x, avtree.y, avtree.z)
vertex = MCScore.MCVertex(avtree.x, avtree.y, avtree.z)
# reading secondary particles...
nsec= aptree.np
namelist= aptree.namelist
pname= namelist.split()
nsec = aptree.np
namelist = aptree.namelist
pname = namelist.split()
for ip in xrange(nsec):
particle= MCScore.MCParticle(pname[ip], aptree.Z[ip], aptree.A[ip],
aptree.kE[ip], aptree.px[ip],
aptree.py[ip], aptree.pz[ip])
particle = MCScore.MCParticle(pname[ip], aptree.Z[ip], aptree.A[ip],
aptree.kE[ip], aptree.px[ip],
aptree.py[ip], aptree.pz[ip])
vertex.append_particle(particle)
analyze_vertex(vertex)
return n_vertex
# ==================================================================
# test
# ==================================================================
# ------------------------------------------------------------------
def test_t2root():
# ------------------------------------------------------------------
g= ROOT.TFile("reaction.root", 'recreate')
g = ROOT.TFile("reaction.root", 'recreate')
rootio= MCScoreROOTIO()
rootio = MCScoreROOTIO()
rootio.define_tree()
f= open("reaction.dat")
f = open("reaction.dat")
f.seek(0)
while(1):
vertex= MCScore.read_next_vertex(f)
if(vertex==0):
vertex = MCScore.read_next_vertex(f)
if vertex == 0:
break
# filling ...
@@ -172,19 +172,18 @@ def test_t2root():
# ------------------------------------------------------------------
def test_loop():
# ------------------------------------------------------------------
def my_analysis(vertex):
vertex.printout()
f= ROOT.TFile("reaction.root", 'read')
nv= loop_tree(f, my_analysis)
f = ROOT.TFile("reaction.root", 'read')
nv = loop_tree(f, my_analysis)
print "*** # of vertex= ", nv
# ==================================================================
# main
# ==================================================================
if (__name__ == "__main__") :
if __name__ == "__main__":
test_t2root()
test_loop()