Geant4  10.02.p03
demo.App Class Reference
Inheritance diagram for demo.App:
Collaboration diagram for demo.App:

Public Member Functions

def init (self)
 
def __init__ (self, master=None)
 
def cmd_beamOn (self)
 
def init (self)
 
def cmd_beamOn (self)
 
def cmd_g4command (self)
 
def cmd_particle (self, particle)
 
def cmd_energy (self, penergy)
 
def cmd_expand (self)
 
def cmd_up (self)
 
def cmd_down (self)
 
def cmd_right (self)
 
def cmd_left (self)
 
def cmd_shrink (self)
 
def __init__ (self, master=None)
 
def init (self)
 
def cmd_beamOn (self)
 
def cmd_setProcess (self)
 
def cmd_g4command (self)
 
def cmd_particle (self, particle)
 
def cmd_energy (self, penergy)
 
def cmd_viewer (self)
 
def cmd_expand (self)
 
def cmd_pan (self)
 
def cmd_shrink (self)
 
def __init__ (self, master=None)
 

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 demos/TestEm0/demo.py.

Constructor & Destructor Documentation

◆ __init__() [1/3]

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

Definition at line 154 of file demos/TestEm0/demo.py.

154  def __init__(self, master=None):
155  Frame.__init__(self, master)
156  self.init()
157  self.grid()
158 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __init__() [2/3]

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

Definition at line 287 of file education/lesson1/demo.py.

287  def __init__(self, master=None):
288  Frame.__init__(self, master)
289  self.init()
290  self.grid()
291 
292 
Here is the call graph for this function:

◆ __init__() [3/3]

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

Definition at line 419 of file education/lesson2/demo.py.

419  def __init__(self, master=None):
420  Frame.__init__(self, master)
421  self.init()
422  self.grid()
423 
424 
Here is the call graph for this function:

Member Function Documentation

◆ cmd_beamOn() [1/3]

def demo.App.cmd_beamOn (   self)

Definition at line 159 of file demos/TestEm0/demo.py.

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

◆ cmd_beamOn() [2/3]

def demo.App.cmd_beamOn (   self)

Definition at line 209 of file education/lesson1/demo.py.

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

◆ cmd_beamOn() [3/3]

def demo.App.cmd_beamOn (   self)

Definition at line 327 of file education/lesson2/demo.py.

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

◆ cmd_down()

def demo.App.cmd_down (   self)

Definition at line 269 of file education/lesson1/demo.py.

269  def cmd_down(self):
270  gApplyUICommand("/vis/viewer/pan " + " 0. -10. mm")
271 

◆ cmd_energy() [1/2]

def demo.App.cmd_energy (   self,
  penergy 
)

Definition at line 259 of file education/lesson1/demo.py.

259  def cmd_energy(self, penergy):
260  gApplyUICommand("/gun/energy " + penergy + " MeV")
261 
262 
Here is the caller graph for this function:

◆ cmd_energy() [2/2]

def demo.App.cmd_energy (   self,
  penergy 
)

Definition at line 373 of file education/lesson2/demo.py.

373  def cmd_energy(self, penergy):
374  gApplyUICommand("/gun/energy " + penergy + " MeV")
375 
376 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmd_expand() [1/2]

def demo.App.cmd_expand (   self)

Definition at line 263 of file education/lesson1/demo.py.

263  def cmd_expand(self):
264  gApplyUICommand("/vis/viewer/zoom 1.2")
265 
Here is the caller graph for this function:

◆ cmd_expand() [2/2]

def demo.App.cmd_expand (   self)

Definition at line 407 of file education/lesson2/demo.py.

407  def cmd_expand(self):
408  gApplyUICommand("/vis/viewer/zoom 1.2")
409 
Here is the call graph for this function:

◆ cmd_g4command() [1/2]

def demo.App.cmd_g4command (   self)

Definition at line 252 of file education/lesson1/demo.py.

252  def cmd_g4command(self):
253  gApplyUICommand(self.g4commandVar.get())
254 
Here is the caller graph for this function:

◆ cmd_g4command() [2/2]

def demo.App.cmd_g4command (   self)

Definition at line 366 of file education/lesson2/demo.py.

366  def cmd_g4command(self):
367  gApplyUICommand(self.g4commandVar.get())
368 
Here is the call graph for this function:

◆ cmd_left()

def demo.App.cmd_left (   self)

Definition at line 275 of file education/lesson1/demo.py.

275  def cmd_left(self):
276  gApplyUICommand("/vis/viewer/pan " + " 1. 0. mm")
277 
278 

◆ cmd_pan()

def demo.App.cmd_pan (   self)

Definition at line 410 of file education/lesson2/demo.py.

410  def cmd_pan(self):
411  gApplyUICommand("/vis/viewer/pan " + self.panXYVar.get() + " " + " mm")
412 
413 

◆ cmd_particle() [1/2]

def demo.App.cmd_particle (   self,
  particle 
)

Definition at line 255 of file education/lesson1/demo.py.

255  def cmd_particle(self, particle):
256  gApplyUICommand("/gun/particle " + particle)
257 
258 
Here is the caller graph for this function:

◆ cmd_particle() [2/2]

def demo.App.cmd_particle (   self,
  particle 
)

Definition at line 369 of file education/lesson2/demo.py.

369  def cmd_particle(self, particle):
370  gApplyUICommand("/gun/particle " + particle)
371 
372 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmd_right()

def demo.App.cmd_right (   self)

Definition at line 272 of file education/lesson1/demo.py.

272  def cmd_right(self):
273  gApplyUICommand("/vis/viewer/pan " + " -1. 0. mm")
274 

◆ cmd_setProcess()

def demo.App.cmd_setProcess (   self)

Definition at line 357 of file education/lesson2/demo.py.

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

◆ cmd_shrink() [1/2]

def demo.App.cmd_shrink (   self)

Definition at line 279 of file education/lesson1/demo.py.

279  def cmd_shrink(self):
280  gApplyUICommand("/vis/viewer/zoom 0.8")
281 
282 
283 # def cmd_reset(self):
284 # gApplyUICommand("/vis/viewer/pan " + " 0. 0. mm")
285 
286 
Here is the caller graph for this function:

◆ cmd_shrink() [2/2]

def demo.App.cmd_shrink (   self)

Definition at line 414 of file education/lesson2/demo.py.

414  def cmd_shrink(self):
415  gApplyUICommand("/vis/viewer/zoom 0.8")
416 
417 
418 
Here is the call graph for this function:

◆ cmd_up()

def demo.App.cmd_up (   self)

Definition at line 266 of file education/lesson1/demo.py.

266  def cmd_up(self):
267  gApplyUICommand("/vis/viewer/pan " + " 0. 10. mm")
268 

◆ cmd_viewer()

def demo.App.cmd_viewer (   self)

Definition at line 377 of file education/lesson2/demo.py.

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

◆ init() [1/3]

def demo.App.init (   self)

Definition at line 56 of file demos/TestEm0/demo.py.

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

◆ init() [2/3]

def demo.App.init (   self)

Definition at line 103 of file education/lesson1/demo.py.

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

◆ init() [3/3]

def demo.App.init (   self)

Definition at line 145 of file education/lesson2/demo.py.

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

Member Data Documentation

◆ absorbermaterialVar

demo.App.absorbermaterialVar

Definition at line 163 of file education/lesson2/demo.py.

◆ absorberthickVar

demo.App.absorberthickVar

Definition at line 174 of file education/lesson2/demo.py.

◆ calorsizeYZVar

demo.App.calorsizeYZVar

Definition at line 203 of file education/lesson2/demo.py.

◆ cutsEntry

demo.App.cutsEntry

Definition at line 130 of file demos/TestEm0/demo.py.

◆ cutsListBox

demo.App.cutsListBox

Definition at line 134 of file demos/TestEm0/demo.py.

◆ cutVar

demo.App.cutVar

Definition at line 280 of file education/lesson2/demo.py.

◆ energyEntry

demo.App.energyEntry

Definition at line 107 of file demos/TestEm0/demo.py.

◆ energyListBox

demo.App.energyListBox

Definition at line 111 of file demos/TestEm0/demo.py.

◆ energyVar

demo.App.energyVar

Definition at line 149 of file education/lesson1/demo.py.

◆ eventVar

demo.App.eventVar

Definition at line 157 of file education/lesson1/demo.py.

◆ g4commandVar

demo.App.g4commandVar

Definition at line 314 of file education/lesson2/demo.py.

◆ g4pipe [1/2]

int demo.App.g4pipe = 0
static

Definition at line 143 of file education/lesson2/demo.py.

◆ g4pipe [2/2]

demo.App.g4pipe

Definition at line 402 of file education/lesson2/demo.py.

◆ gapmaterialVar

demo.App.gapmaterialVar

Definition at line 184 of file education/lesson2/demo.py.

◆ gapthickVar

demo.App.gapthickVar

Definition at line 195 of file education/lesson2/demo.py.

◆ layerVar

demo.App.layerVar

Definition at line 154 of file education/lesson2/demo.py.

◆ magVar

demo.App.magVar

Definition at line 289 of file education/lesson2/demo.py.

◆ materialListBox

demo.App.materialListBox

Definition at line 88 of file demos/TestEm0/demo.py.

◆ materialVar

demo.App.materialVar

Definition at line 114 of file education/lesson1/demo.py.

◆ particleListBox

demo.App.particleListBox

Definition at line 69 of file demos/TestEm0/demo.py.

◆ particleVar

demo.App.particleVar

Definition at line 137 of file education/lesson1/demo.py.

◆ processList

demo.App.processList

Definition at line 263 of file education/lesson2/demo.py.

◆ processVar

demo.App.processVar

Definition at line 265 of file education/lesson2/demo.py.

◆ solid

demo.App.solid

Definition at line 132 of file education/lesson1/demo.py.

◆ thickVar

demo.App.thickVar

Definition at line 125 of file education/lesson1/demo.py.

◆ viewerVar

demo.App.viewerVar

Definition at line 299 of file education/lesson2/demo.py.


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