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

Classes

class  MainWindow
 
class  TextView
 

Functions

def g4_configure
 
def plot_charged
 
def plot_gamma
 
def main
 

Function Documentation

def emcalc_gui.g4_configure ( )

Definition at line 20 of file emcalc_gui.py.

20 
21 def g4_configure() :
23  g4py.EMSTDpl.Construct()
24 
25 # -------------------------------------------------------------------
26 # plot for chaged particles
# -------------------------------------------------------------------
def Configure
Definition: EmPlot.py:18
def g4_configure
Definition: emcalc_gui.py:20

Here is the call graph for this function:

Here is the caller graph for this function:

def emcalc_gui.main ( )

Definition at line 342 of file emcalc_gui.py.

343 def main() :
345 
346  default_stdout = sys.stdout
347  global mycout
348  sys.stdout = mycout = StringIO()
349 
350  # G4 setup
351  g4_configure()
352 
353  # start GUI
354  application = MainWindow()
355  gtk.main()
356 
357  gTerminate()
358  sys.stdout = default_stdout
359 
def g4_configure
Definition: emcalc_gui.py:20
void SetG4PyCoutDestination()
Definition: pyglobals.cc:50
def gTerminate
Definition: __init__.py:221

Here is the call graph for this function:

def emcalc_gui.plot_charged (   material,
  pname 
)

Definition at line 27 of file emcalc_gui.py.

27 
28 def plot_charged(material, pname) :
29  EmPlot.SetMaterial(material)
30 
31  # initialize G4 kernel
32  gRunManager.Initialize()
33  gRunManagerKernel.RunInitialization()
34 
35  # energy
36  elist= []
37  for n in range(-3, 3):
38  for i in range(10,99):
39  elist.append(i/10.*10.**n *MeV)
40 
41  # calculate stopping power
42  global mycout
43  mycout.close()
44  sys.stdout = mycout = StringIO()
45  dedx_list= g4py.emcalculator.CalculateDEDX(pname, material, elist, 1)
46  xlist_tot=[]
47  xlist_ioni=[]
48  xlist_brems=[]
49 
50  for x in dedx_list:
51  xlist_tot.append((x[0], x[1]["tot"]/(MeV*cm2/g)))
52  xlist_ioni.append((x[0], x[1]["ioni"]/(MeV*cm2/g)))
53  xlist_brems.append((x[0], x[1]["brems"]/(MeV*cm2/g)))
54 
55  # make plot
56  global myCanvas, aplot, bplot, cplot
57  myCanvas = EmPlot.init_root()
58  aplot = EmPlot.make_plot(xlist_tot, pname+" Stopping Power ("+material+")",
59  "dE/dX (MeV cm^{2}/g)")
60  bplot = EmPlot.make_plot(xlist_ioni, "Stopping Power ("+material+")",
61  "dE/dX (MeV cm^{2}/g)", 1)
62  cplot = EmPlot.make_plot(xlist_brems, "Stopping Power ("+material+")",
63  "dE/dX (MeV cm^{2}/g)", 3)
64  myCanvas.SaveAs("/tmp/sp.png")
65 
66 
67 # -------------------------------------------------------------------
68 # plot for gamma
# -------------------------------------------------------------------
def init_root
Definition: EmPlot.py:58
def make_plot
Definition: EmPlot.py:84
const G4ParticleDefinition const G4Material *G4double range
def SetMaterial
Definition: EmPlot.py:25
def plot_charged
Definition: emcalc_gui.py:27

Here is the call graph for this function:

Here is the caller graph for this function:

def emcalc_gui.plot_gamma (   material)

Definition at line 69 of file emcalc_gui.py.

69 
70 def plot_gamma(material) :
71  EmPlot.SetMaterial(material)
72 
73  # initialize G4 kernel
74  gRunManager.Initialize()
75  gRunManagerKernel.RunInitialization()
76 
77  # energy
78  elist= []
79  for n in range(-3, 4):
80  for i in range(10,99):
81  elist.append(i/10.*10.**n *MeV)
82 
83  # calculate cross sections
84  global mycout
85  mycout.close()
86  sys.stdout = mycout = StringIO()
87  xsection_list= g4py.emcalculator.CalculatePhotonCrossSection(material,
88  elist, 1)
89  xlist_tot=[]
90  xlist_comp=[]
91  xlist_pe=[]
92  xlist_conv=[]
93  for x in xsection_list:
94  xlist_tot.append((x[0]/MeV, x[1]["tot"]/(cm2/g)))
95  xlist_comp.append((x[0]/MeV, x[1]["compt"]/(cm2/g)))
96  xlist_pe.append((x[0]/MeV, x[1]["phot"]/(cm2/g)))
97  xlist_conv.append((x[0]/MeV, x[1]["conv"]/(cm2/g)))
98 
99  # make plots
100  global myCanvas, aplot, bplot, cplot, dplot
101  myCanvas = EmPlot.init_root()
102  aplot = EmPlot.make_plot(xlist_tot, "Photon Cross Section ("+material+")",
103  "Cross Section (cm^{2}/g)")
104  bplo = EmPlot.make_plot(xlist_comp, "Photon Cross Section ("+material+")",
105  "Cross Section (cm^{2}/g)", 1)
106  cplot = EmPlot.make_plot(xlist_pe, "Photon Cross Section ("+material+")",
107  "Cross Section (cm^{2}/g)", 7)
108  dplot = EmPlot.make_plot(xlist_conv, "Photon Cross Section ("+material+")",
109  "Cross Section (cm^{2}/g)", 3)
110  myCanvas.SaveAs("/tmp/cs.png")
111 
112 
113 # ==================================================================
114 # GUI
# ==================================================================
def init_root
Definition: EmPlot.py:58
def make_plot
Definition: EmPlot.py:84
const G4ParticleDefinition const G4Material *G4double range
def SetMaterial
Definition: EmPlot.py:25
def plot_gamma
Definition: emcalc_gui.py:69

Here is the call graph for this function:

Here is the caller graph for this function: