Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Data Fields
Lesson1Wx.MyApp Class Reference
Inheritance diagram for Lesson1Wx.MyApp:

Public Member Functions

def __init__
 
def OnPageChanged
 
def OnPageChanging
 
def RunStart
 Run Action. More...
 

Data Fields

 nb
 
 runStart
 
 theMaterial
 
 theParticle
 
 processList
 
 theProcesses
 
 eventNo
 
 lengthUnit
 
 thickSpin
 
 energyUnit
 
 energySpin
 
 solid
 

Detailed Description

Definition at line 416 of file Lesson1Wx.py.

Constructor & Destructor Documentation

def Lesson1Wx.MyApp.__init__ (   self)

Definition at line 417 of file Lesson1Wx.py.

418  def __init__(self):
419  wx.Frame.__init__(self, None, -1, "Geant4Py", wx.DefaultPosition, size=(650,500))
420  self.nb = wx.Notebook(self, -1, wx.DefaultPosition, size=(650,500),
421  style=
422  wx.NB_TOP # | wx.NB_MULTILINE
423  #wx.NB_BOTTOM
424  #wx.NB_LEFT
425  #wx.NB_RIGHT
426  )
427  self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
428  self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging)
429 
430  panel = wx.Panel(self.nb)
431  self.nb.AddPage(panel, "Lesson1")
432 
433  commandPanel = wx.Panel(self.nb)
434  self.nb.AddPage(commandPanel, "Geant4 Commands")
435  comP = ComPanel(commandPanel)
436  gxsizer = wx.BoxSizer(wx.HORIZONTAL)
437  gxsizer.Add(comP)
438  commandPanel.SetSizer(gxsizer)
439 
440  visualizationPanel = wx.Panel(self.nb)
441  self.nb.AddPage(visualizationPanel, "Vis Commands")
442  visP = VisPanel(visualizationPanel)
443  vxsizer = wx.BoxSizer(wx.HORIZONTAL)
444  vxsizer.Add(visP)
445  visualizationPanel.SetSizer(vxsizer)
446 
447 
448 # outmost sizer in the vertical direction
449  bxsizer = wx.BoxSizer(wx.VERTICAL)
450 # nested sizer in the horizontal direction
451  bysizer = wx.BoxSizer(wx.HORIZONTAL)
453  self.runStart = wx.Button(panel, -1, " Run Start", pos=(30,10), size=(80,30))
454  self.Bind(wx.EVT_BUTTON, self.RunStart, self.runStart)
455  bxsizer.Add(self.runStart, 0, wx.ALL)
456 # widgets
457 
458 
459  materialList = absorber.keys()
460  self.theMaterial = SelectOne(panel, "Materials", materialList)
461 
462  particleList = ['gamma', 'e-', 'proton']
463  self.theParticle = SelectOne(panel, "Particles", particleList)
465  self.processList = ["phot", "compt", "conv", "msc", "eIoni", "eBrem", "annihil", "hIoni"]
466  self.theProcesses = Processes(panel, "Processes", self.processList)
468  self.eventNo = Adjuster(panel, "Number of Events", 1 , 100 , 1)
470  self.lengthUnit = {'micrometer':micrometer, 'mm':mm, 'cm':cm, 'm':m}
471  self.thickSpin = FloatCounter(panel, "absorber thickness", self.lengthUnit.keys())
473  self.energyUnit = { 'keV':keV, 'MeV':MeV, 'GeV':GeV, 'TeV':TeV, 'PeV':PeV}
474  self.energySpin = FloatCounter(panel, "incident beam energy", self.energyUnit.keys())
475 
476 # now sizers
477 
478  bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
479  bysizer.Add((10, -1))
480  bysizer.Add(self.theMaterial, 0, wx.EXPAND, 10)
481  bysizer.Add((10, -1))
482  bysizer.Add(self.theParticle, 0, wx.EXPAND, 10)
483  bysizer.Add((10, -1))
484  bysizer.Add(self.theProcesses.sizer, 0, wx.EXPAND, 10)
485 
486  bxsizer.Add(bysizer, 0, wx.EXPAND)
487 
488  bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
489  bxsizer.Add(self.energySpin.sizer, 0, wx.EXPAND)
490  bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
491  bxsizer.Add(self.thickSpin.sizer, 0, wx.EXPAND)
492 
493  bxsizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
494  bxsizer.Add(self.eventNo.sizer, 0, wx.EXPAND)
496  self.solid = g4py.ezgeom.G4EzVolume.GetSold(water_phantom)
497 
498  panel.SetSizer(bxsizer)
499  bxsizer.Fit(self)
500  bxsizer.SetSizeHints(self)
def RunStart
Run Action.
Definition: Lesson1Wx.py:517

Member Function Documentation

def Lesson1Wx.MyApp.OnPageChanged (   self,
  event 
)

Definition at line 501 of file Lesson1Wx.py.

502  def OnPageChanged(self, event):
503  old = event.GetOldSelection()
504  new = event.GetSelection()
505  sel = self.nb.GetSelection()
506  event.Skip()
def Lesson1Wx.MyApp.OnPageChanging (   self,
  event 
)

Definition at line 507 of file Lesson1Wx.py.

508  def OnPageChanging(self, event):
509  old = event.GetOldSelection()
510  new = event.GetSelection()
511  sel = self.nb.GetSelection()
512  event.Skip()
513 
def Lesson1Wx.MyApp.RunStart (   self,
  event 
)

Run Action.

Definition at line 517 of file Lesson1Wx.py.

References python.gApplyUICommand, Lesson1Wx.MyApp.lengthUnit, Lesson1withN03.App.processList, and Lesson1Wx.MyApp.processList.

518  def RunStart(self, event):
519  materialChosen = str( self.theMaterial.GetStringSelection() )
520  water_phantom.SetMaterial(absorber[materialChosen])
521  if materialChosen == "water":
522  water_phantom.SetColor(0., 0.9, 1.0)
523  if materialChosen == "air":
524  water_phantom.SetColor(0.9, 0.9, 1.0)
525  if materialChosen == "lead":
526  water_phantom.SetColor(0.2, 0.2, 0.2)
527  if materialChosen == "iron":
528  water_phantom.SetColor(0.7, 0.5, 0.7)
529  if materialChosen == "aluminum":
530  water_phantom.SetColor(.7, 0.9, 1.0)
531  if materialChosen == "gold":
532  water_phantom.SetColor(1., 0.9, .0)
533 
534  self.solid.SetZHalfLength( self.thickSpin.theValue * self.lengthUnit[self.thickSpin.theUnit] / 2.0 )
535 
536 #
537  gApplyUICommand("/vis/scene/add/text 0 610 610 mm 20 0 0 " + "Geant4Py in Action")
538  gApplyUICommand("/vis/viewer/flush")
539  gApplyUICommand("/gun/particle " + str ( self.theParticle.GetStringSelection() ) )
540  for i in self.processList:
541 # print i, self.theProcesses.processCheck[i].GetValue()
542  gProcessTable.SetProcessActivation(i, 1)
543  if self.theProcesses.processCheck[i].GetValue() != True:
544  gProcessTable.SetProcessActivation(i, 0)
545 
546  gApplyUICommand("/gun/energy " + str ( self.energySpin.valAndUnit.GetValue() ) )
547 
548  eventNum = self.eventNo.slider.GetValue()
549  for i in range(eventNum):
550  gunYZpos = str(i-eventNum/2) + ". -50. cm"
551  gApplyUICommand("/gun/position 0. " + gunYZpos)
552  gRunManager.BeamOn(1)
553 # next line is necessary for vrml to draw trajectories
554  gApplyUICommand("/vis/viewer/update")
def RunStart
Run Action.
Definition: Lesson1Wx.py:517

Field Documentation

Lesson1Wx.MyApp.energySpin

Definition at line 473 of file Lesson1Wx.py.

Lesson1Wx.MyApp.energyUnit

Definition at line 472 of file Lesson1Wx.py.

Lesson1Wx.MyApp.eventNo

Definition at line 467 of file Lesson1Wx.py.

Lesson1Wx.MyApp.lengthUnit

Definition at line 469 of file Lesson1Wx.py.

Referenced by Lesson1Wx.MyApp.RunStart().

Lesson1Wx.MyApp.nb

Definition at line 419 of file Lesson1Wx.py.

Lesson1Wx.MyApp.processList

Definition at line 464 of file Lesson1Wx.py.

Referenced by ExN03.App.cmd_setProcess(), ExN03.App.init(), and Lesson1Wx.MyApp.RunStart().

Lesson1Wx.MyApp.runStart

Definition at line 452 of file Lesson1Wx.py.

Lesson1Wx.MyApp.solid

Definition at line 495 of file Lesson1Wx.py.

Lesson1Wx.MyApp.theMaterial

Definition at line 459 of file Lesson1Wx.py.

Lesson1Wx.MyApp.theParticle

Definition at line 462 of file Lesson1Wx.py.

Lesson1Wx.MyApp.theProcesses

Definition at line 465 of file Lesson1Wx.py.

Lesson1Wx.MyApp.thickSpin

Definition at line 470 of file Lesson1Wx.py.


The documentation for this class was generated from the following file: