Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
demo Namespace Reference

Classes

class  App
 
class  MyPrimaryGeneratorAction
 
class  MyRunAction
 
class  MyEventAction
 
class  MySteppingAction
 
class  ScoreSD
 

Functions

def init_root
 
def hini
 
def hshow
 
def posXZ
 
def Configure
 
def ConstructGeom
 

Variables

tuple myDC = testem0.DetectorConstruction()
 
tuple myPL = testem0.PhysicsList()
 
tuple myPGA = testem0.PrimaryGeneratorAction(myDC)
 
tuple myRA = testem0.RunAction(myDC,myPGA)
 
tuple pg = g4.G4ParticleGun()
 
tuple materialList = testem0.getMaterialTable()
 
tuple particleList = testem0.getParticleTable()
 
list enrgyList = ["eV","keV","MeV","GeV","TeV","PeV"]
 
list cutsList = ["um", "mm" , "cm", "m", "km"]
 
tuple app = App()
 
tuple rand_engine = Ranlux64Engine()
 
tuple exN03geom = g4py.ExN03geom.ExN03DetectorConstruction()
 
tuple exN03PL = g4py.EMSTDpl.PhysicsListEMstd()
 
tuple heprepViewer = os.environ.get("G4HEPREPFILE_VIEWER")
 
tuple heprepDir = os.environ.get("G4HEPREPFILE_DIR")
 
tuple heprepName = os.environ.get("G4HEPREPFILE_NAME")
 
tuple vrmlDir = os.environ.get("G4VRML_DEST_DIR")
 
tuple vrmlViewer = os.environ.get("G4VRMLFILE_VIEWER")
 

Function Documentation

def demo.Configure ( )

Definition at line 20 of file demo.py.

20 
21 def Configure():
22  # ------------------------------------------------------------------
23  # setup for materials
24  # ------------------------------------------------------------------
25  # simple materials for Qgeom
26  g4py.NISTmaterials.Construct()
27 
28  # ------------------------------------------------------------------
29  # setup for geometry
30  # ------------------------------------------------------------------
31  #g4py.Qgeom.Construct()
32  g4py.ezgeom.Construct() # initialize
33 
34  # ------------------------------------------------------------------
35  # setup for physics list
36  # ------------------------------------------------------------------
37  g4py.EMSTDpl.Construct()
38 
39  # ------------------------------------------------------------------
40  # setup for primary generator action
41  # ------------------------------------------------------------------
42  g4py.ParticleGun.Construct()
43  gControlExecute("gun.mac")
44 
45 # ==================================================================
46 # constructing geometry
# ==================================================================
def Configure
Definition: demo.py:20
gControlExecute
Definition: __init__.py:164

Here is the caller graph for this function:

def demo.ConstructGeom ( )

Definition at line 47 of file demo.py.

47 
48 def ConstructGeom():
49  print "* Constructing geometry..."
50  # reset world material
51  global absorber
52  air= G4Material.GetMaterial("G4_AIR", 1)
53  galactic = G4Material.GetMaterial("G4_Galactic", 1)
54  absorber = {} # material's dictionary to be used by a radiobutton
55  aluminum = G4Material.GetMaterial("G4_Al", 1)
56  iron = G4Material.GetMaterial("G4_Fe", 1)
57  silver = G4Material.GetMaterial("G4_Ag", 1)
58  gold = G4Material.GetMaterial("G4_Au", 1)
59  lead = G4Material.GetMaterial("G4_Pb", 1)
60  water = G4Material.GetMaterial("G4_WATER", 1)
61  absorber = {"air":air, "aluminum":aluminum, "iron":iron, "lead":lead, "water":water, "gold":gold}
62  g4py.ezgeom.SetWorldMaterial(galactic)
63  g4py.ezgeom.ResizeWorld(120.*cm, 120.*cm, 100.*cm)
64  # water phantom
65  global water_phantom, water_phantom_pv
66 
67  water_phantom= G4EzVolume("WaterPhantom")
68  water_phantom.CreateBoxVolume(water, 110.*cm, 110.*cm, 10.*cm)
69 
70  water_phantom_pv = water_phantom.PlaceIt(G4ThreeVector(0.,0.,0.*cm))
71 
72 # ==================================================================
73 # main
74 # ==================================================================
75 # ------------------------------------------------------------------
76 # randum number
# ------------------------------------------------------------------
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:602
def ConstructGeom
Definition: demo.py:47

Here is the call graph for this function:

def demo.hini ( )

Definition at line 35 of file demo.py.

35 
36 def hini():
37 # ------------------------------------------------------------------
38  global gPad1
39  gPad1= ROOT.TPad("2D", "2D", 0.02, 0.5, 0.98, 1.)
40  gPad1.Draw()
41  gPad1.cd()
42 
43  ROOT.gStyle.SetPalette(1);
44 
45  global hist_dose2d
46  hist_dose2d= ROOT.TH2D("2D Dose", "Dose Distribution",
47  200, 0., 400.,
48  81, -81., 81.)
49  hist_dose2d.SetXTitle("Z (mm)")
50  hist_dose2d.SetYTitle("X (mm)")
51  hist_dose2d.SetStats(0)
52  hist_dose2d.Draw("colz")
53 
54  gCanvas.cd()
55  global gPad2
56  gPad2= ROOT.TPad("Z", "Z", 0.02, 0., 0.98, 0.5)
57  gPad2.Draw()
58  gPad2.cd()
59 
60  global hist_dosez
61  hist_dosez= ROOT.TH1D("Z Dose", "Depth Dose", 200, 0., 400.)
62  hist_dosez.SetXTitle("(mm)")
63  hist_dosez.SetYTitle("Accumulated Dose (MeV)")
64  hist_dosez.Draw()
65 
# ------------------------------------------------------------------
def hini
Definition: demo.py:35

Here is the caller graph for this function:

def demo.hshow ( )

Definition at line 66 of file demo.py.

66 
67 def hshow():
68 # ------------------------------------------------------------------
69  gPad1.cd()
70  hist_dose2d.Draw("colz")
71  gPad2.cd()
72  hist_dosez.Draw()
73 
74 
75 # ==================================================================
76 # Geant4 PART #
77 # ==================================================================
78 
79 # ==================================================================
80 # user actions in python
# ==================================================================
def hshow
Definition: demo.py:66
def demo.init_root ( )

Definition at line 18 of file demo.py.

18 
19 def init_root():
20 # ------------------------------------------------------------------
21  ROOT.gROOT.Reset()
22 
23  # plot style
24  ROOT.gStyle.SetTextFont(42)
25  ROOT.gStyle.SetTitleFont(42, "X")
26  ROOT.gStyle.SetLabelFont(42, "X")
27  ROOT.gStyle.SetTitleFont(42, "Y")
28  ROOT.gStyle.SetLabelFont(42, "Y")
29 
30  global gCanvas
31  gCanvas= ROOT.TCanvas("water_phantom_plots",
32  "Water Phantom Demo Plots",
33  620, 30, 800, 800)
34 
# ------------------------------------------------------------------
def init_root
Definition: demo.py:18

Here is the caller graph for this function:

def demo.posXZ (   copyN)

Definition at line 140 of file demo.py.

141 def posXZ(copyN):
142  dd= 2.*mm
143  nx= 81
144 
145  iz= copyN/nx
146  ix= copyN-iz*nx-nx/2
147 
148  x0= ix*dd
149  z0= (iz+0.5)*dd
150  return (x0,z0)
151 
152 
153 # ==================================================================
154 # main
155 # ==================================================================
156 # init ROOT...
157 init_root()
158 hini()
159 
160 # configure application
161 #app= demo_wp.MyApplication()
162 #app.Configure()
163 
164 myMaterials= demo_wp.MyMaterials()
165 myMaterials.Construct()
166 
167 myDC= demo_wp.MyDetectorConstruction()
168 gRunManager.SetUserInitialization(myDC)
169 
170 myPL= FTFP_BERT()
171 gRunManager.SetUserInitialization(myPL)
172 
173 # set user actions...
175 gRunManager.SetUserAction(myPGA)
176 
177 myRA= MyRunAction()
178 gRunManager.SetUserAction(myRA)
179 
180 myEA= MyEventAction()
181 gRunManager.SetUserAction(myEA)
182 
183 #mySA= MySteppingAction()
184 #gRunManager.SetUserAction(mySA)
185 
186 # set particle gun
187 #pg= myPGA.particleGun
188 #pg.SetParticleByName("proton")
189 #pg.SetParticleEnergy(230.*MeV)
190 #pg.SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.))
191 #pg.SetParticlePosition(G4ThreeVector(0.,0.,-50.)*cm)
192 
193 # medical beam
194 beam= g4py.MedicalBeam.Construct()
195 beam.particle= "proton"
196 beam.kineticE= 230.*MeV
197 #beam.particle= "gamma"
198 #beam.kineticE= 1.77*MeV
199 beam.sourcePosition= G4ThreeVector(0.,0.,-100.*cm)
200 beam.SSD= 100.*cm
201 beam.fieldXY= [5.*cm, 5.*cm]
202 
203 # initialize
204 gRunManager.Initialize()
205 
206 # set SD (A SD should be set after geometry construction)
207 scoreSD= ScoreSD()
208 myDC.SetSDtoScoreVoxel(scoreSD)
209 
210 # visualization
211 gApplyUICommand("/control/execute vis.mac")
212 
213 # beamOn
214 gRunManager.BeamOn(100)
215 
216 #ROOT.gSystem.Run()
217 
def hini
Definition: demo.py:35
def posXZ
Definition: demo.py:140
gApplyUICommand
Definition: __init__.py:165
def init_root
Definition: demo.py:18

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

tuple demo.app = App()

Definition at line 189 of file demo.py.

list demo.cutsList = ["um", "mm" , "cm", "m", "km"]

Definition at line 45 of file demo.py.

list demo.enrgyList = ["eV","keV","MeV","GeV","TeV","PeV"]

Definition at line 43 of file demo.py.

tuple demo.exN03geom = g4py.ExN03geom.ExN03DetectorConstruction()

Definition at line 41 of file demo.py.

tuple demo.exN03PL = g4py.EMSTDpl.PhysicsListEMstd()

Definition at line 56 of file demo.py.

tuple demo.heprepDir = os.environ.get("G4HEPREPFILE_DIR")

Definition at line 121 of file demo.py.

tuple demo.heprepName = os.environ.get("G4HEPREPFILE_NAME")

Definition at line 122 of file demo.py.

tuple demo.heprepViewer = os.environ.get("G4HEPREPFILE_VIEWER")

Definition at line 120 of file demo.py.

tuple demo.materialList = testem0.getMaterialTable()

Definition at line 39 of file demo.py.

tuple demo.myDC = testem0.DetectorConstruction()

Definition at line 18 of file demo.py.

tuple demo.myPGA = testem0.PrimaryGeneratorAction(myDC)

Definition at line 25 of file demo.py.

tuple demo.myPL = testem0.PhysicsList()

Definition at line 21 of file demo.py.

tuple demo.myRA = testem0.RunAction(myDC,myPGA)

Definition at line 28 of file demo.py.

tuple demo.particleList = testem0.getParticleTable()

Definition at line 41 of file demo.py.

tuple demo.pg = g4.G4ParticleGun()

Definition at line 37 of file demo.py.

tuple demo.rand_engine = Ranlux64Engine()

Definition at line 78 of file demo.py.

tuple demo.vrmlDir = os.environ.get("G4VRML_DEST_DIR")

Definition at line 128 of file demo.py.

tuple demo.vrmlViewer = os.environ.get("G4VRMLFILE_VIEWER")

Definition at line 129 of file demo.py.