Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
demo.App Class Reference
Inheritance diagram for demo.App:
Collaboration diagram for demo.App:

Public Member Functions

def init
 
def __init__
 
def cmd_beamOn
 
def init
 
def cmd_beamOn
 
def cmd_g4command
 
def cmd_particle
 
def cmd_energy
 
def cmd_expand
 
def cmd_up
 
def cmd_down
 
def cmd_right
 
def cmd_left
 
def cmd_shrink
 
def __init__
 
def init
 
def cmd_beamOn
 
def cmd_setProcess
 
def cmd_g4command
 
def cmd_particle
 
def cmd_energy
 
def cmd_viewer
 
def cmd_expand
 
def cmd_pan
 
def cmd_shrink
 
def __init__
 

Public Attributes

 particleListBox
 
 materialListBox
 
 energyEntry
 
 energyListBox
 
 cutsEntry
 
 cutsListBox
 
 materialVar
 
 thickVar
 
 solid
 
 particleVar
 
 energyVar
 
 eventVar
 
 layerVar
 
 absorbermaterialVar
 
 absorberthickVar
 
 gapmaterialVar
 
 gapthickVar
 
 calorsizeYZVar
 
 processList
 
 processVar
 
 cutVar
 
 magVar
 
 viewerVar
 
 g4commandVar
 
 g4pipe
 

Static Public Attributes

int g4pipe = 0
 

Detailed Description

Definition at line 53 of file demo.py.

Constructor & Destructor Documentation

def demo.App.__init__ (   self,
  master = None 
)

Definition at line 154 of file demo.py.

155  def __init__(self, master=None):
156  Frame.__init__(self, master)
157  self.init()
158  self.grid()
def __init__
Definition: demo.py:154
def init
Definition: demo.py:56

Here is the call graph for this function:

Here is the caller graph for this function:

def demo.App.__init__ (   self,
  master = None 
)

Definition at line 287 of file demo.py.

288  def __init__(self, master=None):
289  Frame.__init__(self, master)
290  self.init()
291  self.grid()
292 
def __init__
Definition: demo.py:154
def init
Definition: demo.py:56

Here is the call graph for this function:

def demo.App.__init__ (   self,
  master = None 
)

Definition at line 419 of file demo.py.

420  def __init__(self, master=None):
421  Frame.__init__(self, master)
422  self.init()
423  self.grid()
424 
def __init__
Definition: demo.py:154
def init
Definition: demo.py:56

Here is the call graph for this function:

Member Function Documentation

def demo.App.cmd_beamOn (   self)

Definition at line 159 of file demo.py.

160  def cmd_beamOn(self):
161 
162  # get and set particle
163  if self.particleListBox.curselection():
164  index =int(self.particleListBox.curselection()[0])
165  g4.gApplyUICommand("/gun/particle " + particleList[index])
166 
167  # get and set detector Material
168  if self.materialListBox.curselection():
169  index =int(self.materialListBox.curselection()[0])
170  g4.gApplyUICommand("/testem/det/setMat " + materialList[index])
171 
172  # get and set energy
173  energy = self.energyEntry.get()
174  if self.energyListBox.curselection():
175  index = int(self.energyListBox.curselection()[0])
176  unity = enrgyList[index]
177  g4.gApplyUICommand("/gun/energy " + energy + " " + unity)
178 
179  # get and set cuts
180  cuts = self.cutsEntry.get()
181  if self.cutsListBox.curselection():
182  index = int(self.cutsListBox.curselection()[0])
183  unity = cutsList[index]
184  g4.gApplyUICommand("/testem/phys/setCuts " + cuts + " " + unity)
185 
186  # run beamOn
187  g4.gRunManager.BeamOn(1)
188 
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
def cmd_beamOn
Definition: demo.py:159

Here is the call graph for this function:

Here is the caller graph for this function:

def demo.App.cmd_beamOn (   self)

Definition at line 209 of file demo.py.

210  def cmd_beamOn(self):
211  materialChosen = self.materialVar.get()
212  water_phantom.SetMaterial(absorber[materialChosen])
213 
214  if materialChosen == "water":
215  water_phantom.SetColor(0., 0.9, 1.0)
216 
217  if materialChosen == "air":
218  water_phantom.SetColor(0.9, 0.9, 1.0)
219 
220  if materialChosen == "lead":
221  water_phantom.SetColor(0.2, 0.2, 0.2)
222 
223  if materialChosen == "iron":
224  water_phantom.SetColor(0.7, 0.5, 0.7)
225 
226  if materialChosen == "aluminum":
227  water_phantom.SetColor(.7, 0.9, 1.0)
228 
229  if materialChosen == "gold":
230  water_phantom.SetColor(1., 0.9, .0)
231 
232  self.solid.SetZHalfLength(self.thickVar.get() * mm/2.0)
233 # gControlExecute("oglx.mac") #draw for each run
234  gApplyUICommand("/vis/viewer/flush")
235 
236  self.cmd_particle(self.particleVar.get())
237  self.cmd_energy(self.energyVar.get())
238 # TODO later to reflesh text
239  gApplyUICommand("/vis/scene/add/text 0 610 610 mm 20 0 0 " + " ")
240  gApplyUICommand("/vis/scene/add/text 0 610 610 mm 20 0 0 " + self.materialVar.get() + " = " + str(self.thickVar.get()) + "mm " + self.particleVar.get() + " = "+self.energyVar.get() + "MeV")
241 
242  eventNum = self.eventVar.get()
243  for i in range(eventNum):
244  gunYZpos = str(i-eventNum/2) + ". -20. cm"
245  gApplyUICommand("/gun/position 0. " + gunYZpos)
246  gRunManager.BeamOn(1)
247  sleep(0.01)
248 # self.cmd_expand() #Zoom in to the last diaplayed OGLSX
249 # self.cmd_shrink()
250 
251 
const G4ParticleDefinition const G4Material *G4double range
def cmd_energy
Definition: demo.py:259
gApplyUICommand
Definition: __init__.py:165
def cmd_particle
Definition: demo.py:255
def cmd_beamOn
Definition: demo.py:159

Here is the call graph for this function:

def demo.App.cmd_beamOn (   self)

Definition at line 327 of file demo.py.

328  def cmd_beamOn(self):
329  exN03geom.SetNbOfLayers(self.layerVar.get())
330  exN03geom.SetAbsorberMaterial(self.absorbermaterialVar.get())
331  exN03geom.SetAbsorberThickness(self.absorberthickVar.get() * mm/2.0)
332  exN03geom.SetGapMaterial(self.gapmaterialVar.get())
333  exN03geom.SetGapThickness(self.gapthickVar.get() * mm/2.0)
334  exN03geom.SetCalorSizeYZ(self.calorsizeYZVar.get() * mm)
335  position = -self.layerVar.get()*(self.absorberthickVar.get() + self.gapthickVar.get())*1.2
336 
337  exN03geom.UpdateGeometry()
338  exN03PL.SetDefaultCutValue(self.cutVar.get() * mm)
339  exN03PL.SetCutsWithDefault()
340  exN03geom.SetMagField(self.magVar.get() * tesla)
341 
342  print "Now geometry updated"
343 
344 
345  self.cmd_particle(self.particleVar.get())
346  self.cmd_energy(self.energyVar.get())
347 
348  print position
349 
350  eventNum = self.eventVar.get()
351  for i in range(eventNum):
352 
353  pg.SetParticlePosition(G4ThreeVector(position*mm, (i-eventNum/2)*5.*mm, 0.*cm))
354  gRunManager.BeamOn(1)
355  sleep(0.01)
356  gApplyUICommand("/vis/viewer/update")
const G4ParticleDefinition const G4Material *G4double range
def cmd_energy
Definition: demo.py:259
gApplyUICommand
Definition: __init__.py:165
def cmd_particle
Definition: demo.py:255
def cmd_beamOn
Definition: demo.py:159

Here is the call graph for this function:

def demo.App.cmd_down (   self)

Definition at line 269 of file demo.py.

270  def cmd_down(self):
271  gApplyUICommand("/vis/viewer/pan " + " 0. -10. mm")
gApplyUICommand
Definition: __init__.py:165
def cmd_down
Definition: demo.py:269
def demo.App.cmd_energy (   self,
  penergy 
)

Definition at line 259 of file demo.py.

260  def cmd_energy(self, penergy):
261  gApplyUICommand("/gun/energy " + penergy + " MeV")
262 
def cmd_energy
Definition: demo.py:259
gApplyUICommand
Definition: __init__.py:165

Here is the caller graph for this function:

def demo.App.cmd_energy (   self,
  penergy 
)

Definition at line 373 of file demo.py.

374  def cmd_energy(self, penergy):
375  gApplyUICommand("/gun/energy " + penergy + " MeV")
376 
def cmd_energy
Definition: demo.py:259
gApplyUICommand
Definition: __init__.py:165

Here is the call graph for this function:

Here is the caller graph for this function:

def demo.App.cmd_expand (   self)

Definition at line 263 of file demo.py.

264  def cmd_expand(self):
265  gApplyUICommand("/vis/viewer/zoom 1.2")
gApplyUICommand
Definition: __init__.py:165
def cmd_expand
Definition: demo.py:263

Here is the caller graph for this function:

def demo.App.cmd_expand (   self)

Definition at line 407 of file demo.py.

408  def cmd_expand(self):
409  gApplyUICommand("/vis/viewer/zoom 1.2")
gApplyUICommand
Definition: __init__.py:165
def cmd_expand
Definition: demo.py:263

Here is the call graph for this function:

def demo.App.cmd_g4command (   self)

Definition at line 252 of file demo.py.

253  def cmd_g4command(self):
254  gApplyUICommand(self.g4commandVar.get())
gApplyUICommand
Definition: __init__.py:165
def cmd_g4command
Definition: demo.py:252

Here is the caller graph for this function:

def demo.App.cmd_g4command (   self)

Definition at line 366 of file demo.py.

367  def cmd_g4command(self):
368  gApplyUICommand(self.g4commandVar.get())
gApplyUICommand
Definition: __init__.py:165
def cmd_g4command
Definition: demo.py:252

Here is the call graph for this function:

def demo.App.cmd_left (   self)

Definition at line 275 of file demo.py.

276  def cmd_left(self):
277  gApplyUICommand("/vis/viewer/pan " + " 1. 0. mm")
278 
gApplyUICommand
Definition: __init__.py:165
def cmd_left
Definition: demo.py:275
def demo.App.cmd_pan (   self)

Definition at line 410 of file demo.py.

411  def cmd_pan(self):
412  gApplyUICommand("/vis/viewer/pan " + self.panXYVar.get() + " " + " mm")
413 
gApplyUICommand
Definition: __init__.py:165
def cmd_pan
Definition: demo.py:410
def demo.App.cmd_particle (   self,
  particle 
)

Definition at line 255 of file demo.py.

256  def cmd_particle(self, particle):
257  gApplyUICommand("/gun/particle " + particle)
258 
gApplyUICommand
Definition: __init__.py:165
def cmd_particle
Definition: demo.py:255

Here is the caller graph for this function:

def demo.App.cmd_particle (   self,
  particle 
)

Definition at line 369 of file demo.py.

370  def cmd_particle(self, particle):
371  gApplyUICommand("/gun/particle " + particle)
372 
gApplyUICommand
Definition: __init__.py:165
def cmd_particle
Definition: demo.py:255

Here is the call graph for this function:

Here is the caller graph for this function:

def demo.App.cmd_right (   self)

Definition at line 272 of file demo.py.

273  def cmd_right(self):
274  gApplyUICommand("/vis/viewer/pan " + " -1. 0. mm")
gApplyUICommand
Definition: __init__.py:165
def cmd_right
Definition: demo.py:272
def demo.App.cmd_setProcess (   self)

Definition at line 357 of file demo.py.

358  def cmd_setProcess(self):
359  for i in self.processList:
360  if self.processVar[i].get() == 0:
361  gProcessTable.SetProcessActivation(i, 0)
362  print "Process " + i + " inactivated"
363  else:
364  gProcessTable.SetProcessActivation(i, 1)
365  print "Process " + i + " activated"
processVar
Definition: demo.py:265
processList
Definition: demo.py:263
def cmd_setProcess
Definition: demo.py:357
def demo.App.cmd_shrink (   self)

Definition at line 279 of file demo.py.

280  def cmd_shrink(self):
281  gApplyUICommand("/vis/viewer/zoom 0.8")
282 
283 
284 # def cmd_reset(self):
285 # gApplyUICommand("/vis/viewer/pan " + " 0. 0. mm")
286 
gApplyUICommand
Definition: __init__.py:165
def cmd_shrink
Definition: demo.py:279

Here is the caller graph for this function:

def demo.App.cmd_shrink (   self)

Definition at line 414 of file demo.py.

415  def cmd_shrink(self):
416  gApplyUICommand("/vis/viewer/zoom 0.8")
417 
418 
gApplyUICommand
Definition: __init__.py:165
def cmd_shrink
Definition: demo.py:279

Here is the call graph for this function:

def demo.App.cmd_up (   self)

Definition at line 266 of file demo.py.

267  def cmd_up(self):
268  gApplyUICommand("/vis/viewer/pan " + " 0. 10. mm")
def cmd_up
Definition: demo.py:266
gApplyUICommand
Definition: __init__.py:165
def demo.App.cmd_viewer (   self)

Definition at line 377 of file demo.py.

378  def cmd_viewer(self):
379  if self.viewerVar.get() == "OpenGL":
380  gApplyUICommand("/vis/viewer/select oglsxviewer")
381  gApplyUICommand("/vis/scene/add/trajectories")
382 
383  gApplyUICommand("/tracking/storeTrajectory 1")
384  gApplyUICommand("/vis/scene/endOfEventAction accumulate")
385  gApplyUICommand("/vis/scene/endOfRunAction accumulate")
386 
387  if self.viewerVar.get() == "VRML":
388  gApplyUICommand("/vis/viewer/select vrmlviewer")
389  gApplyUICommand("/vis/scene/add/trajectories")
390 
391  gApplyUICommand("/tracking/storeTrajectory 1")
392  gApplyUICommand("/vis/scene/endOfEventAction accumulate")
393  gApplyUICommand("/vis/scene/endOfRunAction accumulate")
394 
395  if self.viewerVar.get() == "Wired":
396  gApplyUICommand("/vis/viewer/select wired")
397  gApplyUICommand("/vis/scene/add/trajectories")
398 
399  gApplyUICommand("/tracking/storeTrajectory 1")
400  gApplyUICommand("/vis/scene/endOfEventAction accumulate")
401  gApplyUICommand("/vis/scene/endOfRunAction accumulate")
403  if self.g4pipe == 0:
404  Popen(heprepViewer + " -file " + heprepDir + "/" + heprepName +".heprep", shell=True)
405  self.g4pipe = 1
406 
int g4pipe
Definition: demo.py:143
def cmd_viewer
Definition: demo.py:377
gApplyUICommand
Definition: __init__.py:165
def demo.App.init (   self)

Definition at line 56 of file demo.py.

56 
57  def init(self):
58 
59 # title and header
60  title = Label(self, text="testem0 empowered by Geant4Py\n\n\n")
61  title.grid(row=0, column=1, columnspan = 4)
62 
63 # particle list box
64  particle_title = Label(self, text="Particle")
65  particle_title.grid(row=2, column=0)
66 
67  particleFrame = Frame(self)
68  scrollbar2 = Scrollbar(particleFrame)
69  scrollbar2.pack(side = RIGHT, fill = Y)
70  self.particleListBox = Listbox(particleFrame, yscrollcommand=scrollbar2.set, exportselection=FALSE,height = 6)
71  self.particleListBox.pack(side = LEFT)
72  for item in particleList:
73  self.particleListBox.insert(END, item)
74  scrollbar2.config(command=self.particleListBox.yview)
75  particleFrame.grid(row=3, column=0)
76  self.particleListBox.select_set(0)
77 
78 # separator frame
79  fblank = Frame(self,width = 40)
80  fblank.grid(row=3,column=1)
81 
82 # material list box
83  detmaterial_title = Label(self, text="Material")
84  detmaterial_title.grid(row=2, column=2)
85 
86  materialFrame = Frame(self)
87  scrollbar = Scrollbar(materialFrame)
88  scrollbar.pack(side = RIGHT, fill = Y)
89  self.materialListBox = Listbox(materialFrame, yscrollcommand=scrollbar.set, exportselection=FALSE, height = 6)
90  self.materialListBox.pack(side = LEFT, fill = Y)
91  for item in materialList:
92  self.materialListBox.insert(END, item)
93  scrollbar.config(command=self.materialListBox.yview)
94  materialFrame.grid(row=3, column=2)
95  self.materialListBox.select_set(0)
96 
97 # separator frame
98  fblank = Frame(self,width = 40)
99  fblank.grid(row=3,column=3)
100 
101 # energy
102  fEnergy = Frame(self)
103  energyLabel = Label(self, text="Energy")
104  energyLabel.grid(row = 2, column = 4)
105 
106  scrollbarEnergy = Scrollbar(fEnergy)
107  scrollbarEnergy.pack(side = RIGHT, fill = Y)
108  self.energyEntry = Entry(fEnergy, width= 8 );
109  self.energyEntry.pack(side = TOP)
110  self.energyEntry.insert(0, "1.0")
112  self.energyListBox = Listbox(fEnergy, yscrollcommand=scrollbarEnergy.set,exportselection=FALSE,width=8,height = 5)
113  self.energyListBox.pack(side = BOTTOM )
114  for item in enrgyList:
115  self.energyListBox.insert(END, item)
116  scrollbarEnergy.config(command=self.energyListBox.yview)
117  fEnergy.grid(row = 3, column = 4 )
118  self.energyListBox.select_set(0)
119 
120 # separator frame
121  fblank = Frame(self,width = 40)
122  fblank.grid(row=3,column=5)
123 
124 # cuts
125  fCuts = Frame(self)
126  cutsLabel = Label(self, text="Cuts", width= 8)
127  cutsLabel.grid(row = 2, column = 6)
128 
129  scrollbarCuts = Scrollbar(fCuts)
130  scrollbarCuts.pack(side = RIGHT, fill = Y)
131  self.cutsEntry = Entry(fCuts, width= 8);
132  self.cutsEntry.pack(side = TOP)
133  self.cutsEntry.insert(0, "1.0")
135  self.cutsListBox = Listbox(fCuts, width= 8 ,yscrollcommand=scrollbarCuts.set,exportselection=FALSE,height = 5)
136  self.cutsListBox.pack(side = BOTTOM )
137  for item in cutsList:
138  self.cutsListBox.insert(END, item)
139  scrollbarCuts.config(command=self.cutsListBox.yview)
140  fCuts.grid(row = 3, column = 6 )
141  self.cutsListBox.select_set(0)
142 
143 # separator frame
144  fblank = Frame(self,height = 40)
145  fblank.grid(row=4,column=0)
146 
147 # start a run button
148  startBut = Button(self, bg="green", text="Start a run", command=self.cmd_beamOn)
149  startBut.grid(row=5, column=2, sticky=W)
150 
151 # exit button
152  exitBut = Button(self, bg="grey", text="Exit", command=self.quit)
153  exitBut.grid(row=5, column=6, sticky=E)
energyListBox
Definition: demo.py:111
cutsEntry
Definition: demo.py:130
energyEntry
Definition: demo.py:107
cutsListBox
Definition: demo.py:134
materialListBox
Definition: demo.py:88
def init
Definition: demo.py:56
def cmd_beamOn
Definition: demo.py:159
particleListBox
Definition: demo.py:69

Here is the caller graph for this function:

def demo.App.init (   self)

Definition at line 103 of file demo.py.

104  def init(self):
105 
106 #title and header row=0, 1
107  title = Label(self, text="Geant4Py for Education @ H. Yoshida Naruto Univ. of Education")
108  title.grid(row=0, column=1, columnspan=5)
109  header = Label(self, text="Measurement of Mass Attenuation Coefficient")
110  header.grid(row=1, column=1, columnspan=5)
111 
112 #material selection row=2
113  materialLabel = Label(self, bg="green", text="Material")
114  materialLabel.grid(row=2, column=0, sticky=W)
115  self.materialVar = StringVar()
116  self.materialVar.set("water")
117  ra1 = { }
118  pos=1
119  for i in absorber.keys():
120  ra1[i] = Radiobutton(self, text=i, variable=self.materialVar, value=i)
121  ra1[i].grid(row=2, column=pos, sticky=W)
122  pos=pos+1
123 
124 #absorber thickness row=3
125  thickLabel = Label(self, bg="green", text="Thickness (mm)")
126  self.thickVar = DoubleVar()
127  self.thickVar.set(100.0)
128  thick = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=100., resolution=0.05, tickinterval=10.0, digits=4, variable=self.thickVar)
129  thickLabel.grid(row=3, column=0, sticky=W)
130  thick.grid(row=3, column=1, columnspan=5, sticky=W)
131 
132 #get logical volume and set its half length
133  self.solid = g4py.ezgeom.G4EzVolume.GetSold(water_phantom)
134 
135 #particle row=4
136  particleLabel = Label(self, bg="green", text="Particle")
137  particleLabel.grid(row=4, column=0, sticky=W)
138  self.particleVar = StringVar()
139  self.particleVar.set("gamma")
140  ra1 = { }
141  pos1=1
142  for i in ("gamma", "e-"):
143  ra1[i] = Radiobutton(self, text=i, variable=self.particleVar, value=i)
144  ra1[i].grid(row=4, column=pos1, sticky=W)
145  pos1=pos1+1
146 
147 #energy row=5
148  energyLabel = Label(self, bg="green", text="Energy (MeV)")
150  self.energyVar=StringVar()
151  self.energyVar.set(1)
152  energy = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=100., tickinterval=10.0, resolution=0.1, variable=self.energyVar, digits=4 )
153  energyLabel.grid(row=5, column=0, sticky=W)
154  energy.grid(row=5, column=1, columnspan=5, sticky=W)
155 
156 #number of event row=6
157  eventLabel = Label(self, bg="green", text="Events")
158  self.eventVar=IntVar()
159  event = Scale(self, orient=HORIZONTAL, length=400, from_=1, to=100, tickinterval=10, resolution=1, variable=self.eventVar )
160  eventLabel.grid(row=6, column=0, sticky=W)
161  event.grid(row=6, column=1, columnspan=5, sticky=W)
162 
163 #start a run button row=7
164  startBut = Button(self, bg="orange", text="Start a run", command=self.cmd_beamOn)
165  startBut.grid(row=0, column=0, sticky=W)
166 
167 #Zoom in/out Pan X Y row=8
168  visLabel = Label(self, text="viewer", bg="orange")
169  expandBut = Button(self, text="Zoom in", command=self.cmd_expand)
170  shrinkBut = Button(self, text="Zoom out", command=self.cmd_shrink)
171  visLabel.grid(row=8, column=0, sticky=W)
172  expandBut.grid(row=8, column=1, sticky=W)
173  shrinkBut.grid(row=8, column=2, sticky=W)
174 
175  upBut = Button(self, text="Up", command=self.cmd_up)
176  downBut = Button(self, text="Down", command=self.cmd_down)
177  upBut.grid(row=8, column=3, sticky=W)
178  downBut.grid(row=8, column=4, sticky=W)
179 
180  leftBut = Button(self, text="Left", command=self.cmd_left)
181  rightBut = Button(self, text="Right", command=self.cmd_right)
182  leftBut.grid(row=8, column=5, sticky=W)
183  rightBut.grid(row=8, column=6, sticky=W)
184 # later
185 # resetBut = Button(self, text="Reset", command=self.cmd_reset)
186 # resetBut.grid(row=8, column=7, sticky=W)
187 
188 
189 # panLabel = Label(self, text="Pan X Y (mm)")
190 # self.panXYVar = StringVar()
191 # panXYEnt = Entry(self, textvariable=self.panXYVar)
192 # panBut = Button(self, bg="orange", text="OK", command=self.cmd_pan)
193 # panLabel.grid(row=8, column=3, sticky=W)
194 # panXYEnt.grid(row=8, column=4)
195 # panBut.grid(row=8, column=5)
196 #Geant4 command entry row = 9
197 # g4comLabel = Label(self, text="Geant4 command")
198 # self.g4commandVar = StringVar()
199 # commandEntry = Entry(self, textvariable=self.g4commandVar)
200 # comBut = Button(self, bg="orange", text="Execute", command=self.cmd_g4command)
201 # g4comLabel.grid(row=9, column=0, sticky=W)
202 # commandEntry.grid(row=9, column=1, columnspan=4, sticky=E+W)
203 # comBut.grid(row=9, column=5)
204 
205 #exit row = 10
206  exitBut = Button(self, bg="red", text="End all", command=sys.exit)
207  exitBut.grid(row=0, column=6, sticky=W)
208 
#on Run butto do...
def cmd_up
Definition: demo.py:266
materialVar
Definition: demo.py:114
def cmd_expand
Definition: demo.py:263
energyVar
Definition: demo.py:149
def init
Definition: demo.py:56
def cmd_right
Definition: demo.py:272
eventVar
Definition: demo.py:157
def cmd_down
Definition: demo.py:269
def cmd_beamOn
Definition: demo.py:159
def cmd_left
Definition: demo.py:275
solid
Definition: demo.py:132
particleVar
Definition: demo.py:137
thickVar
Definition: demo.py:125
def cmd_shrink
Definition: demo.py:279

Here is the call graph for this function:

Here is the caller graph for this function:

def demo.App.init (   self)

Definition at line 145 of file demo.py.

146  def init(self):
147 
148 #title and header row=0, 1
149  title = Label(self, text="exampleN03")
150  title.grid(row=0, column=1, columnspan=3)
151  header = Label(self, text="empowered by \n Geant4Py")
152  header.grid(row=1, column=1, columnspan=3)
153 # number of layers
154  layerLabel = Label(self, bg="green", text="No of layers")
155  self.layerVar=IntVar()
156  self.layerVar.set(10)
157  layer = Scale(self, orient=HORIZONTAL, length=400, from_=0, to=10, tickinterval=1, resolution=1, variable=self.layerVar )
158  layerLabel.grid(row=2, column=0, sticky=W)
159  layer.grid(row=2, column=1, columnspan=5, sticky=W)
160 
161 #absorber material selection row=3
162  absorbermaterialLabel = Label(self, bg="green", text="Absorber Material")
163  absorbermaterialLabel.grid(row=3, column=0, sticky=W)
164  self.absorbermaterialVar = StringVar()
165  self.absorbermaterialVar.set("Lead")
166  ra1 = { }
167  pos=1
168  for i in ("Aluminium", "Lead"):
169  ra1[i] = Radiobutton(self, text=i, variable=self.absorbermaterialVar, value=i)
170  ra1[i].grid(row=3, column=pos, sticky=W)
171  pos=pos+1
172 
173 #absorber thickness row=4
174  absorberthickLabel = Label(self, bg="green", text="Thickness (mm)")
175  self.absorberthickVar = DoubleVar()
176  self.absorberthickVar.set(10.0)
177  absorberthick = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=100., resolution=0.05, tickinterval=10.0, digits=4, variable=self.absorberthickVar)
178  absorberthickLabel.grid(row=4, column=0, sticky=W)
179  absorberthick.grid(row=4, column=1, columnspan=5, sticky=W)
180 
181 
182 #gap material selection row=5
183  gapmaterialLabel = Label(self, bg="green", text="Gap Material")
184  gapmaterialLabel.grid(row=5, column=0, sticky=W)
185  self.gapmaterialVar = StringVar()
186  self.gapmaterialVar.set("liquidArgon")
187  ra2 = { }
188  pos=1
189  for i in ("liquidArgon","Scintillator", "Air", "Aerogel", "Galactic" ):
190  ra2[i] = Radiobutton(self, text=i, variable=self.gapmaterialVar, value=i)
191  ra2[i].grid(row=5, column=pos, sticky=W)
192  pos=pos+1
193 
194 #gap thickness row=6
195  gapthickLabel = Label(self, bg="green", text="Thickness (mm)")
196  self.gapthickVar = DoubleVar()
197  self.gapthickVar.set(5.0)
198  gapthick = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=100., resolution=0.05, tickinterval=10.0, digits=4, variable=self.gapthickVar)
199  gapthickLabel.grid(row=6, column=0, sticky=W)
200  gapthick.grid(row=6, column=1, columnspan=5, sticky=W)
201 
202 #calorSizeYZ row=7
203  calorsizeYZLabel = Label(self, bg="green", text="SizeYZ (mm)")
204  self.calorsizeYZVar = DoubleVar()
205  self.calorsizeYZVar.set(100.0)
206  calorsizeYZ = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=200., resolution=0.05, tickinterval=20.0, digits=4, variable=self.calorsizeYZVar)
207  calorsizeYZLabel.grid(row=7, column=0, sticky=W)
208  calorsizeYZ.grid(row=7, column=1, columnspan=5, sticky=W)
209 
210 
211 #particle row=8
212  particleLabel = Label(self, bg="green", text="Particle")
213  particleLabel.grid(row=8, column=0, sticky=W)
214  self.particleVar = StringVar()
215  self.particleVar.set("e-")
216  ra1 = { }
217  pos1=1
218  for i in ("proton", "gamma", "e-", "e+", "mu-", "mu+"):
219  ra1[i] = Radiobutton(self, text=i, variable=self.particleVar, value=i)
220  ra1[i].grid(row=8, column=pos1, sticky=W)
221  pos1=pos1+1
222 
223 #energy row=9
224  energyLabel = Label(self, bg="green", text="Energy (MeV)")
225 
226  self.energyVar=StringVar()
227  self.energyVar.set(50)
228  energy = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=1000., tickinterval=100.0, resolution=0.1, variable=self.energyVar, digits=5 )
229  energyLabel.grid(row=9, column=0, sticky=W)
230  energy.grid(row=9, column=1, columnspan=5, sticky=W)
231 
232 #number of event row=10
233  eventLabel = Label(self, bg="green", text="Events")
234  self.eventVar=IntVar()
235  self.eventVar.set(3)
236  event = Scale(self, orient=HORIZONTAL, length=400, from_=0, to=100, tickinterval=10, resolution=1, variable=self.eventVar )
237  eventLabel.grid(row=10, column=0, sticky=W)
238  event.grid(row=10, column=1, columnspan=5, sticky=W)
239 
240 #start a run button row=0
241  startBut = Button(self, bg="orange", text="Start a run", command=self.cmd_beamOn)
242  startBut.grid(row=0, column=0, sticky=W)
243 
244 #Zoom in/out Pan X Y row=13
245 # visLabel = Label(self, text="viewer", bg="orange")
246 # expandBut = Button(self, text="Zoom in", command=self.cmd_expand)
247 # shrinkBut = Button(self, text="Zoom out", command=self.cmd_shrink)
248 # visLabel.grid(row=13, column=0, sticky=W)
249 # expandBut.grid(row=13, column=1, sticky=W)
250 # shrinkBut.grid(row=13, column=2, sticky=W)
251 # panLabel = Label(self, text="Pan X Y(mm)")
252 # self.panXYVar = StringVar()
253 # panXYEnt = Entry(self, textvariable=self.panXYVar, width=6)
254 # panBut = Button(self, bg="orange", text="OK", command=self.cmd_pan)
255 # panLabel.grid(row=13, column=3, sticky=W)
256 # panXYEnt.grid(row=13, column=4)
257 # panBut.grid(row=13, column=5)
258 
259 # process activate row 11 - 13
260  processLabel=Label(self, text="Process on/off", bg="green")
261  processLabel.grid(row=11, column=0, sticky=W)
262  procTab = {}
264  self.processList = ["phot", "compt", "conv", "msc", "eIoni", "eBrem", "annihil","muIoni", "muBrems", "hIoni"]
265  pos=1
266  self.processVar = {}
267  for i in self.processList:
268  self.processVar[i] = IntVar()
269  procTab[i] = Checkbutton(self, text=i, variable=self.processVar[i], command=self.cmd_setProcess)
270  if pos <= 3:
271  procTab[i].grid(row=11, column=pos, sticky=W)
272  if 4<= pos <= 7:
273  procTab[i].grid(row=12, column=pos-3, sticky=W)
274  if pos >= 8:
275  procTab[i].grid(row=13, column=pos-7, sticky=W)
276  pos=pos+1
277  procTab[i].select()
278 # set cuts row 14
279  cutLabel = Label(self, bg="green", text="Cut (mm)")
281  self.cutVar=DoubleVar()
282  self.cutVar.set(1.)
283  cut = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=10., tickinterval=1., resolution=0.005, variable=self.cutVar, digits=5 )
284  cutLabel.grid(row=14, column=0, sticky=W)
285  cut.grid(row=14, column=1, columnspan=5, sticky=W)
286 
287 # set mag field row 15
288  magLabel = Label(self, bg="green", text="Magnetic (T)")
290  self.magVar=DoubleVar()
291  self.magVar.set(0.)
292  mag = Scale(self, orient=HORIZONTAL, length=400, from_=0., to=5., tickinterval=1., resolution=0.1, variable=self.magVar, digits=3 )
293  magLabel.grid(row=15, column=0, sticky=W)
294  mag.grid(row=15, column=1, columnspan=5, sticky=W)
295 
296 
297 # viewer selection row=16
298  viewerLabel = Label(self, bg="green", text="Viewer")
299  viewerLabel.grid(row=16, column=0, sticky=W)
300  self.viewerVar = StringVar()
301  self.viewerVar.set("")
302  stateOfViewer = {"OpenGL":"normal", "VRML":"normal", "Wired":"normal"}
303  if vrmlViewer is None: stateOfViewer["VRML"] = "disabled"
304  if heprepViewer is None: stateOfViewer["Wired"] = "disabled"
305  viewers = { }
306  pos=1
307  for i in ("OpenGL", "VRML", "Wired"):
308  viewers[i] = Radiobutton(self, text=i, variable=self.viewerVar, value=i, command=self.cmd_viewer, state=stateOfViewer[i])
309  viewers[i].grid(row=16, column=pos, sticky=W)
310  pos=pos+1
311 
312 
313 #Geant4 command entry row = 17
314  g4comLabel = Label(self, text="Geant4 command", bg="orange")
315  self.g4commandVar = StringVar()
316  commandEntry = Entry(self, textvariable=self.g4commandVar, width=15)
317  self.g4commandVar.set("/vis/viewer/zoom 1.2")
318  comBut = Button(self, bg="orange", text="Execute", command=self.cmd_g4command)
319  g4comLabel.grid(row=17, column=0, sticky=W)
320  commandEntry.grid(row=17, column=1, columnspan=3, sticky=E+W)
321  comBut.grid(row=17, column=5)
322 
323 #exit row = 0
324  exitBut = Button(self, bg="red", text="End all", command=sys.exit)
325  exitBut.grid(row=0, column=5, sticky=W)
326 
#on Run butto do...
processVar
Definition: demo.py:265
absorbermaterialVar
Definition: demo.py:163
gapthickVar
Definition: demo.py:195
cutVar
Definition: demo.py:280
absorberthickVar
Definition: demo.py:174
def cmd_viewer
Definition: demo.py:377
viewerVar
Definition: demo.py:299
calorsizeYZVar
Definition: demo.py:203
def cmd_g4command
Definition: demo.py:252
gapmaterialVar
Definition: demo.py:184
g4commandVar
Definition: demo.py:314
energyVar
Definition: demo.py:149
processList
Definition: demo.py:263
def init
Definition: demo.py:56
def cmd_setProcess
Definition: demo.py:357
layerVar
Definition: demo.py:154
eventVar
Definition: demo.py:157
def cmd_beamOn
Definition: demo.py:159
magVar
Definition: demo.py:289
particleVar
Definition: demo.py:137

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

demo.App.absorbermaterialVar

Definition at line 163 of file demo.py.

demo.App.absorberthickVar

Definition at line 174 of file demo.py.

demo.App.calorsizeYZVar

Definition at line 203 of file demo.py.

demo.App.cutsEntry

Definition at line 130 of file demo.py.

demo.App.cutsListBox

Definition at line 134 of file demo.py.

demo.App.cutVar

Definition at line 280 of file demo.py.

demo.App.energyEntry

Definition at line 107 of file demo.py.

demo.App.energyListBox

Definition at line 111 of file demo.py.

demo.App.energyVar

Definition at line 149 of file demo.py.

demo.App.eventVar

Definition at line 157 of file demo.py.

demo.App.g4commandVar

Definition at line 314 of file demo.py.

int demo.App.g4pipe = 0
static

Definition at line 143 of file demo.py.

demo.App.g4pipe

Definition at line 402 of file demo.py.

demo.App.gapmaterialVar

Definition at line 184 of file demo.py.

demo.App.gapthickVar

Definition at line 195 of file demo.py.

demo.App.layerVar

Definition at line 154 of file demo.py.

demo.App.magVar

Definition at line 289 of file demo.py.

demo.App.materialListBox

Definition at line 88 of file demo.py.

demo.App.materialVar

Definition at line 114 of file demo.py.

demo.App.particleListBox

Definition at line 69 of file demo.py.

demo.App.particleVar

Definition at line 137 of file demo.py.

demo.App.processList

Definition at line 263 of file demo.py.

demo.App.processVar

Definition at line 265 of file demo.py.

demo.App.solid

Definition at line 132 of file demo.py.

demo.App.thickVar

Definition at line 125 of file demo.py.

demo.App.viewerVar

Definition at line 299 of file demo.py.


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