Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eplot.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 # ==================================================================
3 # An example of ploting by EmCalculator
4 #
5 # Plotting photon cross sections and stopping power
6 # ==================================================================
7 from Geant4 import *
8 import g4py.ExN03pl
9 import g4py.emcalculator
10 import EmPlot
11 
12 # initialize
14 
15 # user physics list
16 g4py.ExN03pl.Construct()
17 
18 # target material
19 material= "G4_Cu"
20 EmPlot.SetMaterial(material)
21 
22 # initialize G4 kernel
23 gRunManager.Initialize()
24 gRunManagerKernel.RunInitialization()
25 
26 # energy
27 elist= []
28 for n in range(-3, 3):
29  for i in range(10,99):
30  elist.append(i/10.*10.**n *MeV)
31 
32 # calculate stopping power
33 pname= "e-"
34 dedx_list= g4py.emcalculator.CalculateDEDX(pname, material, elist, 1)
35 xlist_tot=[]
36 xlist_ioni=[]
37 xlist_brems=[]
38 
39 for x in dedx_list:
40  xlist_tot.append((x[0], x[1]["tot"]/(MeV*cm2/g)))
41  xlist_ioni.append((x[0], x[1]["ioni"]/(MeV*cm2/g)))
42  xlist_brems.append((x[0], x[1]["brems"]/(MeV*cm2/g)))
43 
44 # make plot
45 myCanvas= EmPlot.init_root()
46 aplot= EmPlot.make_plot(xlist_tot, pname+" Stopping Power ("+material+")",
47  "dE/dX (MeV cm^{2}/g)")
48 bplot= EmPlot.make_plot(xlist_ioni, "Stopping Power ("+material+")",
49  "dE/dX (MeV cm^{2}/g)", 1)
50 cplot= EmPlot.make_plot(xlist_brems, "Stopping Power ("+material+")",
51  "dE/dX (MeV cm^{2}/g)", 3)
52 
def init_root
Definition: EmPlot.py:58
def Configure
Definition: EmPlot.py:18
def make_plot
Definition: EmPlot.py:84
const G4ParticleDefinition const G4Material *G4double range
def SetMaterial
Definition: EmPlot.py:25