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

Public Member Functions

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__
 
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__
 

Data Fields

 layerVar
 
 absorbermaterialVar
 
 absorberthickVar
 
 gapmaterialVar
 
 gapthickVar
 
 calorsizeYZVar
 
 particleVar
 
 energyVar
 
 eventVar
 
 processList
 
 processVar
 
 cutVar
 
 magVar
 
 viewerVar
 
 g4commandVar
 
 g4pipe
 

Static Public Attributes

int g4pipe = 0
 

Detailed Description

Definition at line 141 of file ExN03.py.

Constructor & Destructor Documentation

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

Definition at line 419 of file ExN03.py.

References testem0.App.init(), Lesson1.App.init(), Lesson1withN03.App.init(), ccdpm25dprin.init, ExN03.App.init(), and c2_cached_function_p< float_type >.init.

Referenced by ExN03.App.__init__().

420  def __init__(self, master=None):
421  Frame.__init__(self, master)
422  self.init()
423  self.grid()
424 
def init
Definition: ExN03.py:145
def __init__
Definition: ExN03.py:419
def ExN03.App.__init__ (   self,
  master = None 
)

Definition at line 419 of file python3/ExN03.py.

References ExN03.App.__init__(), testem0.App.init(), Lesson1.App.init(), Lesson1withN03.App.init(), ccdpm25dprin.init, ExN03.App.init(), and c2_cached_function_p< float_type >.init.

420  def __init__(self, master=None):
421  Frame.__init__(self, master)
422  self.init()
423  self.grid()
424 
def init
Definition: ExN03.py:145
def __init__
Definition: ExN03.py:419

Member Function Documentation

def ExN03.App.cmd_beamOn (   self)

Definition at line 327 of file ExN03.py.

References Lesson1.App.cmd_energy(), Lesson1withN03.App.cmd_energy(), ExN03.App.cmd_energy(), Lesson1.App.cmd_particle(), Lesson1withN03.App.cmd_particle(), ExN03.App.cmd_particle(), and python.gApplyUICommand.

Referenced by ExN03.App.cmd_beamOn(), and ExN03.App.init().

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")
def cmd_beamOn
Definition: ExN03.py:327
def cmd_energy
Definition: ExN03.py:373
def cmd_particle
Definition: ExN03.py:369
def ExN03.App.cmd_beamOn (   self)

Definition at line 327 of file python3/ExN03.py.

References ExN03.App.cmd_beamOn(), Lesson1.App.cmd_energy(), Lesson1withN03.App.cmd_energy(), ExN03.App.cmd_energy(), Lesson1.App.cmd_particle(), Lesson1withN03.App.cmd_particle(), ExN03.App.cmd_particle(), python.gApplyUICommand, and print().

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")
def cmd_beamOn
Definition: ExN03.py:327
def cmd_energy
Definition: ExN03.py:373
def cmd_particle
Definition: ExN03.py:369
void print(const std::vector< T > &data)
Definition: DicomRun.hh:111
def ExN03.App.cmd_energy (   self,
  penergy 
)

Definition at line 373 of file python3/ExN03.py.

References ExN03.App.cmd_energy(), and python.gApplyUICommand.

374  def cmd_energy(self, penergy):
375  gApplyUICommand("/gun/energy " + penergy + " MeV")
376 
def cmd_energy
Definition: ExN03.py:373
def ExN03.App.cmd_energy (   self,
  penergy 
)

Definition at line 373 of file ExN03.py.

References python.gApplyUICommand.

Referenced by ExN03.App.cmd_beamOn(), and ExN03.App.cmd_energy().

374  def cmd_energy(self, penergy):
375  gApplyUICommand("/gun/energy " + penergy + " MeV")
376 
def cmd_energy
Definition: ExN03.py:373
def ExN03.App.cmd_expand (   self)

Definition at line 407 of file ExN03.py.

References python.gApplyUICommand.

Referenced by ExN03.App.cmd_expand().

408  def cmd_expand(self):
409  gApplyUICommand("/vis/viewer/zoom 1.2")
def cmd_expand
Definition: ExN03.py:407
def ExN03.App.cmd_expand (   self)

Definition at line 407 of file python3/ExN03.py.

References ExN03.App.cmd_expand(), and python.gApplyUICommand.

408  def cmd_expand(self):
409  gApplyUICommand("/vis/viewer/zoom 1.2")
def cmd_expand
Definition: ExN03.py:407
def ExN03.App.cmd_g4command (   self)

Definition at line 366 of file ExN03.py.

References python.gApplyUICommand.

Referenced by ExN03.App.cmd_g4command(), and ExN03.App.init().

367  def cmd_g4command(self):
368  gApplyUICommand(self.g4commandVar.get())
def cmd_g4command
Definition: ExN03.py:366
def ExN03.App.cmd_g4command (   self)

Definition at line 366 of file python3/ExN03.py.

References ExN03.App.cmd_g4command(), and python.gApplyUICommand.

367  def cmd_g4command(self):
368  gApplyUICommand(self.g4commandVar.get())
def cmd_g4command
Definition: ExN03.py:366
def ExN03.App.cmd_pan (   self)

Definition at line 410 of file python3/ExN03.py.

References ExN03.App.cmd_pan(), and python.gApplyUICommand.

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

Definition at line 410 of file ExN03.py.

References python.gApplyUICommand.

Referenced by ExN03.App.cmd_pan().

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

Definition at line 369 of file python3/ExN03.py.

References ExN03.App.cmd_particle(), and python.gApplyUICommand.

370  def cmd_particle(self, particle):
371  gApplyUICommand("/gun/particle " + particle)
372 
def cmd_particle
Definition: ExN03.py:369
def ExN03.App.cmd_particle (   self,
  particle 
)

Definition at line 369 of file ExN03.py.

References python.gApplyUICommand.

Referenced by ExN03.App.cmd_beamOn(), and ExN03.App.cmd_particle().

370  def cmd_particle(self, particle):
371  gApplyUICommand("/gun/particle " + particle)
372 
def cmd_particle
Definition: ExN03.py:369
def ExN03.App.cmd_setProcess (   self)

Definition at line 357 of file python3/ExN03.py.

References ExN03.App.cmd_setProcess(), print(), Lesson1withN03.App.processList, ExN03.App.processList, Lesson1Wx.MyApp.processList, Lesson1withN03.App.processVar, and ExN03.App.processVar.

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: ExN03.py:265
def cmd_setProcess
Definition: ExN03.py:357
processList
Definition: ExN03.py:263
void print(const std::vector< T > &data)
Definition: DicomRun.hh:111
def ExN03.App.cmd_setProcess (   self)

Definition at line 357 of file ExN03.py.

References Lesson1withN03.App.processList, ExN03.App.processList, Lesson1Wx.MyApp.processList, Lesson1withN03.App.processVar, and ExN03.App.processVar.

Referenced by ExN03.App.cmd_setProcess(), and ExN03.App.init().

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: ExN03.py:265
def cmd_setProcess
Definition: ExN03.py:357
processList
Definition: ExN03.py:263
def ExN03.App.cmd_shrink (   self)

Definition at line 414 of file ExN03.py.

References python.gApplyUICommand.

Referenced by ExN03.App.cmd_shrink().

415  def cmd_shrink(self):
416  gApplyUICommand("/vis/viewer/zoom 0.8")
417 
418 
def cmd_shrink
Definition: ExN03.py:414
def ExN03.App.cmd_shrink (   self)

Definition at line 414 of file python3/ExN03.py.

References ExN03.App.cmd_shrink(), and python.gApplyUICommand.

415  def cmd_shrink(self):
416  gApplyUICommand("/vis/viewer/zoom 0.8")
417 
418 
def cmd_shrink
Definition: ExN03.py:414
def ExN03.App.cmd_viewer (   self)

Definition at line 377 of file ExN03.py.

References python.gApplyUICommand.

Referenced by ExN03.App.cmd_viewer(), and ExN03.App.init().

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: ExN03.py:143
def cmd_viewer
Definition: ExN03.py:377
def ExN03.App.cmd_viewer (   self)

Definition at line 377 of file python3/ExN03.py.

References ExN03.App.cmd_viewer(), ExN03.App.g4pipe, and python.gApplyUICommand.

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")
402 
403  if self.g4pipe == 0:
404  Popen(heprepViewer + " -file " + heprepDir + "/" + heprepName +".heprep", shell=True)
405  self.g4pipe = 1
406 
int g4pipe
Definition: ExN03.py:143
def cmd_viewer
Definition: ExN03.py:377
def ExN03.App.init (   self)

Definition at line 145 of file python3/ExN03.py.

References ExN03.App.absorbermaterialVar, ExN03.App.absorberthickVar, ExN03.App.calorsizeYZVar, testem0.App.cmd_beamOn(), Lesson1.App.cmd_beamOn(), Lesson1withN03.App.cmd_beamOn(), ExN03.App.cmd_beamOn(), Lesson1.App.cmd_g4command(), Lesson1withN03.App.cmd_g4command(), ExN03.App.cmd_g4command(), Lesson1withN03.App.cmd_setProcess(), ExN03.App.cmd_setProcess(), ExN03.App.cmd_viewer(), ExN03.App.cutVar, Lesson1.App.energyVar, Lesson1withN03.App.energyVar, ExN03.App.energyVar, Lesson1.App.eventVar, Lesson1withN03.App.eventVar, ExN03.App.eventVar, ExN03.App.g4commandVar, ExN03.App.gapmaterialVar, ExN03.App.gapthickVar, ExN03.App.init(), ExN03.App.layerVar, ExN03.App.magVar, Lesson1.App.particleVar, Lesson1withN03.App.particleVar, ExN03.App.particleVar, Lesson1withN03.App.processList, ExN03.App.processList, Lesson1Wx.MyApp.processList, Lesson1withN03.App.processVar, ExN03.App.processVar, and ExN03.App.viewerVar.

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 = {}
263 
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)")
280 
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)")
289 
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...
energyVar
Definition: ExN03.py:225
def cmd_beamOn
Definition: ExN03.py:327
absorbermaterialVar
Definition: ExN03.py:163
absorberthickVar
Definition: ExN03.py:174
def init
Definition: ExN03.py:145
viewerVar
Definition: ExN03.py:299
processVar
Definition: ExN03.py:265
def cmd_viewer
Definition: ExN03.py:377
def cmd_setProcess
Definition: ExN03.py:357
def cmd_g4command
Definition: ExN03.py:366
gapthickVar
Definition: ExN03.py:195
gapmaterialVar
Definition: ExN03.py:184
g4commandVar
Definition: ExN03.py:314
particleVar
Definition: ExN03.py:213
calorsizeYZVar
Definition: ExN03.py:203
eventVar
Definition: ExN03.py:233
processList
Definition: ExN03.py:263
layerVar
Definition: ExN03.py:154
def ExN03.App.init (   self)

Definition at line 145 of file ExN03.py.

Referenced by ExN03.App.__init__(), and ExN03.App.init().

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)")
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 = {}
263 
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...
energyVar
Definition: ExN03.py:225
def cmd_beamOn
Definition: ExN03.py:327
absorbermaterialVar
Definition: ExN03.py:163
absorberthickVar
Definition: ExN03.py:174
def init
Definition: ExN03.py:145
viewerVar
Definition: ExN03.py:299
processVar
Definition: ExN03.py:265
def cmd_viewer
Definition: ExN03.py:377
def cmd_setProcess
Definition: ExN03.py:357
def cmd_g4command
Definition: ExN03.py:366
gapthickVar
Definition: ExN03.py:195
gapmaterialVar
Definition: ExN03.py:184
g4commandVar
Definition: ExN03.py:314
particleVar
Definition: ExN03.py:213
calorsizeYZVar
Definition: ExN03.py:203
eventVar
Definition: ExN03.py:233
processList
Definition: ExN03.py:263
layerVar
Definition: ExN03.py:154

Field Documentation

ExN03.App.absorbermaterialVar

Definition at line 163 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.absorberthickVar

Definition at line 174 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.calorsizeYZVar

Definition at line 203 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.cutVar

Definition at line 280 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.energyVar

Definition at line 225 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.eventVar

Definition at line 233 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.g4commandVar

Definition at line 314 of file ExN03.py.

Referenced by ExN03.App.init().

int ExN03.App.g4pipe = 0
static

Definition at line 143 of file ExN03.py.

Referenced by ExN03.App.cmd_viewer().

ExN03.App.g4pipe

Definition at line 402 of file ExN03.py.

ExN03.App.gapmaterialVar

Definition at line 184 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.gapthickVar

Definition at line 195 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.layerVar

Definition at line 154 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.magVar

Definition at line 289 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.particleVar

Definition at line 213 of file ExN03.py.

Referenced by ExN03.App.init().

ExN03.App.processList

Definition at line 263 of file ExN03.py.

Referenced by ExN03.App.cmd_setProcess(), and ExN03.App.init().

ExN03.App.processVar

Definition at line 265 of file ExN03.py.

Referenced by ExN03.App.cmd_setProcess(), and ExN03.App.init().

ExN03.App.viewerVar

Definition at line 299 of file ExN03.py.

Referenced by ExN03.App.init().


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