Geant4  10.02.p03
python Namespace Reference

Namespaces

 colortable
 
 g4thread
 
 g4viscp
 
 hepunit
 

Functions

def print_version ()
 
def _one_event (self)
 
def _list_material (self)
 
def gTerminate ()
 
def _run_abort (signum, frame)
 

Variables

string __version__ = '10.2'
 
string __date__ = 'November/2015'
 
string __author__ = 'K.Murakami (Koichi.Murakami@kek.jp)'
 
 gRunManager = G4RunManager()
 
 gRunManagerKernel = G4RunManagerKernel.GetRunManagerKernel()
 
 gUImanager = G4UImanager.GetUIpointer()
 
 gEventManager = G4EventManager.GetEventManager()
 
 gStackManager = gEventManager.GetStackManager()
 
 gTrackingManager = gEventManager.GetTrackingManager()
 
 gStateManager = G4StateManager.GetStateManager()
 
 gExceptionHandler = G4ExceptionHandler()
 
 gGeometryManager = G4GeometryManager.GetInstance()
 
 gTransportationManager = G4TransportationManager.GetTransportationManager()
 
 gParticleTable = G4ParticleTable.GetParticleTable()
 
 gParticleIterator = PyG4ParticleList()
 
 gProcessTable = G4ProcessTable.GetProcessTable()
 
 gLossTableManager = G4LossTableManager.Instance()
 
 gProductionCutsTable = G4ProductionCutsTable.GetProductionCutsTable()
 
 gEmCalculator = G4EmCalculator()
 
 gMaterialTable = G4Material.GetMaterialTable()
 
 gElementTable = G4Element.GetElementTable()
 
 _material_class_list = dir(G4materials)
 
int _qfind = _material_class_list.count("G4NistManager") > 0
 
 gNistManager = G4NistManager.Instance()
 
 _visdriver_list = dir(G4visualization)
 
string _q_opengl_ix = "G4OpenGLImmediateX" in _visdriver_list
 
string _q_opengl_sx = "G4OpenGLStoredX" in _visdriver_list
 
string _q_opengl_ixm = "G4OpenGLImmediateXm" in _visdriver_list
 
string _q_opengl_sxm = "G4OpenGLStoredXm" in _visdriver_list
 
string _q_raytracer_x = "G4RayTracerX" in _visdriver_list
 
 gVisManager = G4VisManager()
 
 _opengl_ix = G4OpenGLImmediateX()
 
 _opengl_sx = G4OpenGLStoredX()
 
 _opengl_ixm = G4OpenGLImmediateXm()
 
 _opengl_sxm = G4OpenGLStoredXm()
 
 _raytracer_x = G4RayTracerX()
 
 _vrml1 = G4VRML1File()
 
 _vrml2 = G4VRML2File()
 
 _dawn = G4DAWNFILE()
 
 _heprep_xml = G4HepRep()
 
 _heprep_file = G4HepRepFile()
 
 _atree = G4ASCIITree()
 
 _raytracer = G4RayTracer()
 
 gG4Version = G4Version
 
 gG4Date = G4Date
 
 gG4VERSION_NUMBER = G4VERSION_NUMBER
 
 gControlExecute = gUImanager.ExecuteMacroFile
 
 gApplyUICommand = G4intercoms.ApplyUICommand
 
 gGetCurrentValues = gUImanager.GetCurrentValues
 
 gStartUISession = G4interface.StartUISession
 

Detailed Description

# ==================================================================
#  [Geant4] module package
#
#  Welcome to Geant4Py.
#
#  This package contains a set of Python interface with Geant4.
# ==================================================================

Function Documentation

◆ _list_material()

def python._list_material (   self)
private

Definition at line 189 of file source/python/__init__.py.

189 def _list_material(self):
190  "list materials."
191  n_materials = len(gMaterialTable)
192  print " +------------------------------------------------------------------"
193  print " | Table of G4Material-s (%d materails defined)" % (n_materials)
194  for i in range(0, n_materials) :
195  material = gMaterialTable[i]
196  print " |--------------------------------------------------------"\
197  "----------"
198  print " | %s: %s" % (material.GetName(),
199  G4BestUnit(material.GetDensity(),"Volumic Mass"))
200 
201  elementVec = material.GetElementVector()
202  fractionVec = material.GetFractionVector()
203  abundanceVec = material.GetVecNbOfAtomsPerVolume()
204  totNAtoms = material.GetTotNbOfAtomsPerVolume()
205 
206  n_elements = len(elementVec)
207  for j in range(0, n_elements):
208  print " | + (%1d) %s(%s): A=%4.1f, N=%5.1f, " \
209  "Frac.=(%4.1f%%m,%4.1f%%a)" % \
210  (j+1, elementVec[j].GetName(), elementVec[j].GetSymbol(),
211  elementVec[j].GetZ(),
212  elementVec[j].GetN(),
213  fractionVec[j]/hepunit.perCent,
214  abundanceVec[j]/totNAtoms/hepunit.perCent)
215 
216  print " +------------------------------------------------------------------"
217 
218 G4MaterialTable.ListMaterial = _list_material
219 
220 
221 # ------------------------------------------------------------------
222 # termination
223 # ------------------------------------------------------------------
def _list_material(self)

◆ _one_event()

def python._one_event (   self)
private

Definition at line 180 of file source/python/__init__.py.

180 def _one_event(self):
181  "generate one event."
182  self.BeamOn(1)
183 
184 G4RunManager.OneEvent = _one_event
185 
186 # ------------------------------------------------------------------
187 # list material information
188 # ------------------------------------------------------------------
def _one_event(self)

◆ _run_abort()

def python._run_abort (   signum,
  frame 
)
private

Definition at line 234 of file source/python/__init__.py.

234 def _run_abort(signum, frame):
235  state = gStateManager.GetCurrentState()
236 
237  if(state == G4ApplicationState.G4State_GeomClosed or
238  state == G4ApplicationState.G4State_EventProc):
239  print "aborting Run ..."
240  gRunManager.AbortRun(True)
241  else:
242  raise KeyboardInterrupt
243 
def _run_abort(signum, frame)
if(nlines<=0)
Here is the call graph for this function:

◆ gTerminate()

def python.gTerminate ( )

Definition at line 224 of file source/python/__init__.py.

224 def gTerminate():
225  gGeometryManager.OpenGeometry()
226 
227 
228 # ------------------------------------------------------------------
229 # signal handler
230 # ------------------------------------------------------------------
Here is the caller graph for this function:

◆ print_version()

def python.print_version ( )

Definition at line 35 of file source/python/__init__.py.

35 def print_version():
36  print """=============================================================
37  Welcome to Geant4Py (A Geant4-Python Bridge)
38 
39  Version : %s
40  Date : %s
41  Contact : %s
42 =============================================================
43 """ % ( __version__, __date__, __author__)
44 
45 # ==================================================================
46 # initialize
47 # ==================================================================
48 # set G4cout/G4cerr to Python stdout
50 
51 # ==================================================================
52 # globals, which start with "g"
53 # ==================================================================
54 # gRunManager
void SetG4PyCoutDestination()
Definition: pyglobals.cc:50
Here is the call graph for this function:

Variable Documentation

◆ __author__

string python.__author__ = 'K.Murakami (Koichi.Murakami@kek.jp)'
private

Definition at line 13 of file source/python/__init__.py.

◆ __date__

string python.__date__ = 'November/2015'
private

Definition at line 12 of file source/python/__init__.py.

◆ __version__

string python.__version__ = '10.2'
private

Definition at line 11 of file source/python/__init__.py.

◆ _atree

python._atree = G4ASCIITree()
private

Definition at line 135 of file source/python/__init__.py.

◆ _dawn

python._dawn = G4DAWNFILE()
private

Definition at line 132 of file source/python/__init__.py.

◆ _heprep_file

python._heprep_file = G4HepRepFile()
private

Definition at line 134 of file source/python/__init__.py.

◆ _heprep_xml

python._heprep_xml = G4HepRep()
private

Definition at line 133 of file source/python/__init__.py.

◆ _material_class_list

python._material_class_list = dir(G4materials)
private

Definition at line 104 of file source/python/__init__.py.

◆ _opengl_ix

python._opengl_ix = G4OpenGLImmediateX()
private

Definition at line 120 of file source/python/__init__.py.

◆ _opengl_ixm

python._opengl_ixm = G4OpenGLImmediateXm()
private

Definition at line 124 of file source/python/__init__.py.

◆ _opengl_sx

python._opengl_sx = G4OpenGLStoredX()
private

Definition at line 122 of file source/python/__init__.py.

◆ _opengl_sxm

python._opengl_sxm = G4OpenGLStoredXm()
private

Definition at line 126 of file source/python/__init__.py.

◆ _q_opengl_ix

string python._q_opengl_ix = "G4OpenGLImmediateX" in _visdriver_list
private

Definition at line 111 of file source/python/__init__.py.

◆ _q_opengl_ixm

string python._q_opengl_ixm = "G4OpenGLImmediateXm" in _visdriver_list
private

Definition at line 113 of file source/python/__init__.py.

◆ _q_opengl_sx

string python._q_opengl_sx = "G4OpenGLStoredX" in _visdriver_list
private

Definition at line 112 of file source/python/__init__.py.

◆ _q_opengl_sxm

string python._q_opengl_sxm = "G4OpenGLStoredXm" in _visdriver_list
private

Definition at line 114 of file source/python/__init__.py.

◆ _q_raytracer_x

string python._q_raytracer_x = "G4RayTracerX" in _visdriver_list
private

Definition at line 115 of file source/python/__init__.py.

◆ _qfind

int python._qfind = _material_class_list.count("G4NistManager") > 0
private

Definition at line 105 of file source/python/__init__.py.

◆ _raytracer

python._raytracer = G4RayTracer()
private

Definition at line 136 of file source/python/__init__.py.

◆ _raytracer_x

python._raytracer_x = G4RayTracerX()
private

Definition at line 128 of file source/python/__init__.py.

◆ _visdriver_list

python._visdriver_list = dir(G4visualization)
private

Definition at line 110 of file source/python/__init__.py.

◆ _vrml1

python._vrml1 = G4VRML1File()
private

Definition at line 130 of file source/python/__init__.py.

◆ _vrml2

python._vrml2 = G4VRML2File()
private

Definition at line 131 of file source/python/__init__.py.

◆ gApplyUICommand

python.gApplyUICommand = G4intercoms.ApplyUICommand

Definition at line 168 of file source/python/__init__.py.

◆ gControlExecute

python.gControlExecute = gUImanager.ExecuteMacroFile

Definition at line 167 of file source/python/__init__.py.

◆ gElementTable

python.gElementTable = G4Element.GetElementTable()

Definition at line 101 of file source/python/__init__.py.

◆ gEmCalculator

python.gEmCalculator = G4EmCalculator()

Definition at line 97 of file source/python/__init__.py.

◆ gEventManager

python.gEventManager = G4EventManager.GetEventManager()

Definition at line 65 of file source/python/__init__.py.

◆ gExceptionHandler

python.gExceptionHandler = G4ExceptionHandler()

Definition at line 75 of file source/python/__init__.py.

◆ gG4Date

python.gG4Date = G4Date

Definition at line 161 of file source/python/__init__.py.

◆ gG4Version

python.gG4Version = G4Version

Definition at line 160 of file source/python/__init__.py.

◆ gG4VERSION_NUMBER

python.gG4VERSION_NUMBER = G4VERSION_NUMBER

Definition at line 162 of file source/python/__init__.py.

◆ gGeometryManager

python.gGeometryManager = G4GeometryManager.GetInstance()

Definition at line 78 of file source/python/__init__.py.

◆ gGetCurrentValues

python.gGetCurrentValues = gUImanager.GetCurrentValues

Definition at line 169 of file source/python/__init__.py.

◆ gLossTableManager

python.gLossTableManager = G4LossTableManager.Instance()

Definition at line 91 of file source/python/__init__.py.

◆ gMaterialTable

python.gMaterialTable = G4Material.GetMaterialTable()

Definition at line 100 of file source/python/__init__.py.

◆ gNistManager

python.gNistManager = G4NistManager.Instance()

Definition at line 107 of file source/python/__init__.py.

◆ gParticleIterator

python.gParticleIterator = PyG4ParticleList()

Definition at line 85 of file source/python/__init__.py.

◆ gParticleTable

python.gParticleTable = G4ParticleTable.GetParticleTable()

Definition at line 84 of file source/python/__init__.py.

◆ gProcessTable

python.gProcessTable = G4ProcessTable.GetProcessTable()

Definition at line 88 of file source/python/__init__.py.

◆ gProductionCutsTable

python.gProductionCutsTable = G4ProductionCutsTable.GetProductionCutsTable()

Definition at line 94 of file source/python/__init__.py.

◆ gRunManager

python.gRunManager = G4RunManager()

Definition at line 56 of file source/python/__init__.py.

◆ gRunManagerKernel

python.gRunManagerKernel = G4RunManagerKernel.GetRunManagerKernel()

Definition at line 59 of file source/python/__init__.py.

◆ gStackManager

python.gStackManager = gEventManager.GetStackManager()

Definition at line 68 of file source/python/__init__.py.

◆ gStartUISession

python.gStartUISession = G4interface.StartUISession

Definition at line 170 of file source/python/__init__.py.

◆ gStateManager

python.gStateManager = G4StateManager.GetStateManager()

Definition at line 74 of file source/python/__init__.py.

◆ gTrackingManager

python.gTrackingManager = gEventManager.GetTrackingManager()

Definition at line 71 of file source/python/__init__.py.

◆ gTransportationManager

python.gTransportationManager = G4TransportationManager.GetTransportationManager()

Definition at line 81 of file source/python/__init__.py.

◆ gUImanager

python.gUImanager = G4UImanager.GetUIpointer()

Definition at line 62 of file source/python/__init__.py.

◆ gVisManager

python.gVisManager = G4VisManager()

Definition at line 118 of file source/python/__init__.py.