SND@LHC Software
Loading...
Searching...
No Matches
eventDisplay.IO Class Reference

Public Member Functions

 __init__ (self)
 
 nextEvent (self, event=None)
 
 toogleMCTracks (self)
 
 toogle (self, x)
 
 __init__ (self)
 
 nextEvent (self, event=None)
 
 toogleMCTracks (self)
 
 toogle (self, x)
 

Public Attributes

 master
 
 fram1
 
 contents
 
 n
 
 nextEvent
 
 lbut
 
 geoscene
 

Detailed Description

Definition at line 408 of file eventDisplay.py.

Constructor & Destructor Documentation

◆ __init__() [1/2]

eventDisplay.IO.__init__ (   self)

Definition at line 409 of file eventDisplay.py.

409 def __init__(self):
410 self.master = tkinter.Tk()
411 self.master.title('SHiP Event Display GUI')
412 self.master.geometry(u'320x580+165+820')
413 self.fram1 = tkinter.Frame(self.master)
414 b = tkinter.Button(self.fram1, text="Next Event",command=self.nextEvent)
415 b.pack(fill=tkinter.BOTH, expand=1)
416 label = tkinter.Label(self.fram1, text='Event number:')
417 label["relief"] = tkinter.RAISED
418 entry = tkinter.Entry(self.fram1)
419 entry["foreground"] = "blue"
420 label.pack(side=tkinter.LEFT)
421 entry.pack(side=tkinter.RIGHT)
422 self.contents = tkinter.IntVar()
423 # set it to some value
424 self.n = 0
425 self.contents.set(self.n)
426 # tell the entry widget to watch this variable
427 entry["textvariable"] = self.contents
428 # and here we get a callback when the user hits return.
429 # we will have the program print out the value of the
430 # application variable when the user hits return
431 entry.bind('<Key-Return>', self.nextEvent)
432 self.lbut = {}
433 x = 'withMC'
434 a = tkinter.IntVar()
435 if globals()['withMCTracks']: a.set(1)
436 else: a.set(0)
437 self.lbut[x] = tkinter.Checkbutton(self.master,text="with MC Tracks",compound=tkinter.LEFT,variable=a)
438 self.lbut[x].var = a
439 self.lbut[x]['command'] = self.toogleMCTracks
440 self.lbut[x].pack(side=tkinter.TOP)
441 self.geoscene = ROOT.gEve.GetScenes().FindChild("Geometry scene")
442 for v in top.GetNodes():
443 x=v.GetName()
444 cmd = 'toogle("'+x+'")'
445 a = tkinter.IntVar()
446 assemb = "Assembly" in v.GetVolume().__str__()
447 if v.IsVisible() or (assemb and v.IsVisDaughters()): a.set(1)
448 else : a.set(0)
449 self.lbut[x] = tkinter.Checkbutton(self.master,text=x.replace('_1',''),compound=tkinter.LEFT,variable=a)
450 self.lbut[x].var = a
451 self.lbut[x]['command'] = lambda j=x: self.toogle(j)
452 self.lbut[x].pack(side=tkinter.BOTTOM)
453 self.fram1.pack()
454# add ship actions to eve display
455 gEve = ROOT.gEve
456 slot = ROOT.TEveWindow.CreateWindowInTab(gEve.GetBrowser().GetTabLeft())
457 slot.SetShowTitleBar(ROOT.kFALSE)
458 packs = slot.MakePack();
459 packs.SetShowTitleBar(ROOT.kFALSE);
460 packs.SetElementName("SHiP actions")
461 packs.SetHorizontal()
462 slot = packs.NewSlot()
463 frame = slot.MakeFrame()
464 frame.SetElementName("commands")
465 frame.SetShowTitleBar(ROOT.kFALSE)
466 cf = frame.GetGUICompositeFrame()
467 hf = ROOT.TGVerticalFrame(cf)
468 hf.SetCleanup(ROOT.kLocalCleanup)
469 hf.SetWidth(150)
470 cf.AddFrame(hf)
471 guiFrame = ROOT.TGVerticalFrame(hf)
472 hf.AddFrame(guiFrame, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
473 guiFrame.SetCleanup(ROOT.kDeepCleanup)
474 b = ROOT.TGTextButton(guiFrame, "Add particle follower")
475 b.SetWidth(150)
476 b.SetToolTipText('start new window with top projection and energy loss')
477 b.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_addParticleFollower.py")')
478 guiFrame.AddFrame(b, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
479 bn = ROOT.TGTextButton(guiFrame, "fill histogram")
480 bn.SetWidth(150)
481 bn.SetToolTipText('Fill histogram with energy along flight path')
482 bn.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_fillEnergy.py")')
483 guiFrame.AddFrame(bn, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
484 bt = ROOT.TGTextButton(guiFrame, "switch transparent mode on/off")
485 bt.SetWidth(150)
486 bt.SetToolTipText('switch transparent mode on/off for better visibility of tracks')
487 bt.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_transparentMode.py")')
488 guiFrame.AddFrame(bt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
489 bnx = ROOT.TGTextButton(guiFrame, "next event")
490 bnx.SetWidth(150)
491 bnx.SetToolTipText('click for next event')
492 bnx.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_nextEvent.py")')
493 guiFrame.AddFrame(bnx, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
494 bzt = ROOT.TGTextButton(guiFrame, "synch zoom top->side")
495 bzt.SetWidth(150)
496 bzt.SetToolTipText('synchronize zoom top with side')
497 bzt.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_synchZoomt.py")')
498 guiFrame.AddFrame(bzt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
499 bzs = ROOT.TGTextButton(guiFrame, "synch zoom side->top")
500 bzs.SetWidth(150)
501 bzs.SetToolTipText('synchronize zoom side with top')
502 bzs.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_synchZooms.py")')
503 guiFrame.AddFrame(bzs, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
504#
505 cf.MapSubwindows()
506 cf.Layout()
507 cf.MapWindow()
set(INCLUDE_DIRECTORIES ${SYSTEM_INCLUDE_DIRECTORIES} ${VMC_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/shipdata ${CMAKE_SOURCE_DIR}/shipLHC ${CMAKE_SOURCE_DIR}/analysis/cuts ${CMAKE_SOURCE_DIR}/analysis/tools ${FMT_INCLUDE_DIR}) include_directories($
Definition CMakeLists.txt:1

◆ __init__() [2/2]

eventDisplay.IO.__init__ (   self)

Definition at line 278 of file eventDisplay.py.

278 def __init__(self):
279# add actions to eve display
280 gEve = ROOT.gEve
281 slot = ROOT.TEveWindow.CreateWindowInTab(gEve.GetBrowser().GetTabLeft())
282 slot.SetShowTitleBar(ROOT.kFALSE)
283 packs = slot.MakePack();
284 packs.SetShowTitleBar(ROOT.kFALSE);
285 packs.SetElementName("ActionsX")
286 packs.SetHorizontal()
287 slot = packs.NewSlot()
288 frame = slot.MakeFrame()
289 frame.SetElementName("commands")
290 frame.SetShowTitleBar(ROOT.kFALSE)
291 cf = frame.GetGUICompositeFrame()
292 hf = ROOT.TGVerticalFrame(cf)
293 hf.SetCleanup(ROOT.kLocalCleanup)
294 hf.SetWidth(150)
295 cf.AddFrame(hf)
296 guiFrame = ROOT.TGVerticalFrame(hf)
297 hf.AddFrame(guiFrame, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
298 guiFrame.SetCleanup(ROOT.kDeepCleanup)
299
300 bnx = ROOT.TGTextButton(guiFrame, "next event")
301 bnx.SetWidth(150)
302 bnx.SetToolTipText('click for next event')
303 bnx.SetCommand('TPython::Exec("import evdsnd_commands ; rc=evdsnd_commands.nextEvent()")')
304 bnx.SetTextColor(ROOT.kBlue)
305 guiFrame.AddFrame(bnx, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
306
307 bt = ROOT.TGTextButton(guiFrame, "switch transparent mode on/off")
308 bt.SetWidth(150)
309 bt.SetToolTipText('switch transparent mode on/off for better visibility of tracks')
310 bt.SetCommand('TPython::Exec("import evdsnd_commands ; rc=evdsnd_commands.transparentMode()")')
311 guiFrame.AddFrame(bt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
312
313 blu = ROOT.TGTextButton(guiFrame, "more light")
314 blu.SetWidth(150)
315 blu.SetToolTipText('increase light power. Front, Side, Specular')
316 blu.SetCommand('TPython::Exec("import evdsnd_commands ; rc=evdsnd_commands.light(0.5)")')
317 guiFrame.AddFrame(blu, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
318 bld = ROOT.TGTextButton(guiFrame, "less light")
319 bld.SetWidth(150)
320 bld.SetToolTipText('decrease light power. Front, Side, Specular')
321 bld.SetCommand('TPython::Exec("import evdsnd_commands ; rc=evdsnd_commands.light(-0.5)")')
322 guiFrame.AddFrame(bld, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
323
324 bld = ROOT.TGTextButton(guiFrame, "fit track")
325 bld.SetWidth(150)
326 bld.SetToolTipText('simple PR, fit track')
327 bld.SetCommand('TPython::Exec("import evdsnd_commands ; rc=evdsnd_commands.fittrack")')
328 guiFrame.AddFrame(bld, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
329
330#
331 cf.MapSubwindows()
332 cf.Layout()
333 cf.MapWindow()

Member Function Documentation

◆ nextEvent() [1/2]

eventDisplay.IO.nextEvent (   self,
  event = None 
)

Definition at line 508 of file eventDisplay.py.

508 def nextEvent(self,event=None):
509 i = int(self.contents.get())
510 if i==self.n: self.n+=1
511 else : self.n=i
512 self.contents.set(self.n)
513 SHiPDisplay.NextEvent(self.n)

◆ nextEvent() [2/2]

eventDisplay.IO.nextEvent (   self,
  event = None 
)

Definition at line 334 of file eventDisplay.py.

334 def nextEvent(self,event=None):
335 i = int(self.contents.get())
336 if i==self.n: self.n+=1
337 else : self.n=i
338 self.contents.set(self.n)
339 SHiPDisplay.NextEvent(self.n)

◆ toogle() [1/2]

eventDisplay.IO.toogle (   self,
  x 
)

Definition at line 525 of file eventDisplay.py.

525 def toogle(self,x):
526 v = top.GetNode(x)
527 assemb = "Assembly" in v.GetVolume().__str__()
528 if v.IsVisible()>0 or assemb and v.IsVisDaughters()>0 :
529 print("switch off ",x)
530 v.SetVisibility(0)
531 v.SetVisDaughters(0)
532 self.lbut[x].var.set(0)
533 else:
534 print("switch on ",x)
535 if assemb: v.SetVisDaughters(1)
536 else: v.SetVisibility(1)
537 self.lbut[x].var.set(1)
538 gEve.ElementChanged(self.geoscene,True,True)
539 for v in top.GetNodes():
540 x = v.GetName()
541 if x in self.lbut:
542 assemb = "Assembly" in v.GetVolume().__str__()
543 if v.IsVisible()>0 or assemb and v.IsVisDaughters()>0 : self.lbut[x].var.set(1)
544 else : self.lbut[x].var.set(0)
545#

◆ toogle() [2/2]

eventDisplay.IO.toogle (   self,
  x 
)

Definition at line 351 of file eventDisplay.py.

351 def toogle(self,x):
352 v = top.GetNode(x)
353 assemb = "Assembly" in v.GetVolume().__str__()
354 if v.IsVisible()>0 or assemb and v.IsVisDaughters()>0 :
355 print("switch off ",x)
356 v.SetVisibility(0)
357 v.SetVisDaughters(0)
358 self.lbut[x].var.set(0)
359 else:
360 print("switch on ",x)
361 if assemb: v.SetVisDaughters(1)
362 else: v.SetVisibility(1)
363 self.lbut[x].var.set(1)
364 gEve.ElementChanged(self.geoscene,True,True)
365 for v in top.GetNodes():
366 x = v.GetName()
367 if x in self.lbut:
368 assemb = "Assembly" in v.GetVolume().__str__()
369 if v.IsVisible()>0 or assemb and v.IsVisDaughters()>0 : self.lbut[x].var.set(1)
370 else : self.lbut[x].var.set(0)
371#

◆ toogleMCTracks() [1/2]

eventDisplay.IO.toogleMCTracks (   self)

Definition at line 514 of file eventDisplay.py.

514 def toogleMCTracks(self):
515 tl = fRun.GetMainTask().GetListOfTasks()
516 geoTask = tl.FindObject("GeoTracks")
517 if globals()['withMCTracks']:
518 globals()['withMCTracks'] = False
519 self.lbut['withMC'].var.set(1)
520 if geoTask: geoTask.SetActive(0)
521 else:
522 globals()['withMCTracks'] = True
523 self.lbut['withMC'].var.set(0)
524 if geoTask: geoTask.SetActive(1)

◆ toogleMCTracks() [2/2]

eventDisplay.IO.toogleMCTracks (   self)

Definition at line 340 of file eventDisplay.py.

340 def toogleMCTracks(self):
341 tl = fRun.GetMainTask().GetListOfTasks()
342 geoTask = tl.FindObject("GeoTracks")
343 if globals()['withMCTracks']:
344 globals()['withMCTracks'] = False
345 self.lbut['withMC'].var.set(1)
346 if geoTask: geoTask.SetActive(0)
347 else:
348 globals()['withMCTracks'] = True
349 self.lbut['withMC'].var.set(0)
350 if geoTask: geoTask.SetActive(1)

Member Data Documentation

◆ contents

eventDisplay.IO.contents

Definition at line 422 of file eventDisplay.py.

◆ fram1

eventDisplay.IO.fram1

Definition at line 413 of file eventDisplay.py.

◆ geoscene

eventDisplay.IO.geoscene

Definition at line 441 of file eventDisplay.py.

◆ lbut

eventDisplay.IO.lbut

Definition at line 432 of file eventDisplay.py.

◆ master

eventDisplay.IO.master

Definition at line 410 of file eventDisplay.py.

◆ n

eventDisplay.IO.n

Definition at line 424 of file eventDisplay.py.

◆ nextEvent

eventDisplay.IO.nextEvent

Definition at line 431 of file eventDisplay.py.


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