12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

AppendixPython 2.6.2 (r262:71600, Oct 24 2009, 03:15:21)[GCC 4.4.1 [gcc-4_4-branch revision 150839]] on linux2Type "help", "copyright", "credits" or "license" <strong>for</strong> more in<strong>for</strong>mation.>>> from <strong>Geant4</strong> import **************************************************************<strong>Geant4</strong> version Name: geant4-09-03(18-December-2009)Copyright : <strong>Geant4</strong> CollaborationReference : NIM A 506 (2003), 250-303WWW : http://cern.ch/geant4*************************************************************Visualization Manager instantiating...>>>8.2.2. Access to <strong>Geant4</strong> GlobalsWhen importing the <strong>Geant4</strong> module, the G4RunManager object will be automatically instantiated. <strong>Geant4</strong> singletonobjects are also automatically instantiated. These singleton objects can be accessed by "gXXXX" variables,like "gRunManager".gLossTableManager gTerminategApplyUICommand gMaterialTable gTrackingManagergControlExecute gNistManager gTransportationManagergElementTable gParticleIterator gUImanagergEmCalculator gParticleTable gVisManagergEventManagergProcessTablegExceptionHandler gProductionCutsTablegG4DategRunManagergG4VERSION_NUMBER gRunManagerKernelgG4VersiongStackManagergGeometryManager gStartUISessiongGetCurrentValues gStateManager8.2.3. Call <strong>Geant4</strong> MethodsOnce a Python object of a <strong>Geant4</strong> class instantiated, <strong>Geant4</strong> methods can be directly called the same way as in C++.>>> from <strong>Geant4</strong> import **************************************************************<strong>Geant4</strong> version Name: geant4-09-03(18-December-2009)Copyright : <strong>Geant4</strong> CollaborationReference : NIM A 506 (2003), 250-303WWW : http://cern.ch/geant4*************************************************************Visualization Manager instantiating...>>> print gRunManager.GetVersionString()<strong>Geant4</strong> version Name: geant4-09-03 (18-December-2009)8.3. Site-modules<strong>Geant4</strong>Py provides additional utility modules called "g4py" in the directory site-modules. It consists of predifinedgeometries, materials, physics lists, primary generator actions, and so on.8.3.1. ezgeom moduleThe ezgeom module provides an alternative way of defining simple geometry. An example code <strong>for</strong> defining asimple geometry is shown here:import g4py.ezgeomfrom g4py.ezgeom import G4EzVolumedef ConstructGeom():print "* Constructing geometry..."# reset world materialair= G4Material.GetMaterial("G4_AIR")g4py.ezgeom.SetWorldMaterial(air)305

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!