Last change
on this file since 1341 was
1337,
checked in by garnier, 14 years ago
|
tag geant4.9.4 beta 1 + modifs locales
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Rev | Line | |
---|
[1337] | 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 |
---|
| 13 | EmPlot.Configure() |
---|
| 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 | |
---|
Note: See
TracBrowser
for help on using the repository browser.