22 ROOT.gStyle.SetTextFont(82)
23 ROOT.gStyle.SetTitleFont(82,
"X")
24 ROOT.gStyle.SetLabelFont(82,
"X")
25 ROOT.gStyle.SetTitleFont(82,
"Y")
26 ROOT.gStyle.SetLabelFont(82,
"Y")
29 ROOT.gStyle.SetErrorX(0)
31 canvas= ROOT.TCanvas(
"g4py_plots",
32 "Geant4Py Sample Plots",
46 hist1= ROOT.TH1D(
"dE/dx/step",
"dE/dx", 100, 0., 2000.)
47 hist1.SetXTitle(
"(keV)")
63 "My Primary Generator Action"
66 G4VUserPrimaryGeneratorAction.__init__(self)
70 self.particleGun.GeneratePrimaryVertex(event)
77 print "*** #event to be processed (BRA)=",
78 run.numberOfEventToBeProcessed
81 print "*** run end run(ERA)=", run.runID
88 print "*** current event (BEA)=", event.eventID
91 print "*** current event (EEA)=", event.eventID
99 dedx= step.GetTotalEnergyDeposit()
101 hist1.Fill(dedx/HEPUnit.keV)
109 app= gtest01.MyApplication()
114 gRunManager.SetUserAction(myPGA)
117 gRunManager.SetUserAction(myRA)
123 gRunManager.SetUserAction(mySA)
128 pg= myPGA.particleGun
129 pg.SetParticleByName(
"e-")
130 pg.SetParticleEnergy(200.*HEPUnit.MeV)
132 pg.SetParticlePosition(
G4ThreeVector(0.,0.,-14.9)*HEPUnit.cm)
135 ApplyUICommand(
"/control/execute vis.mac")
138 gRunManager.BeamOn(1000)