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

Public Member Functions

 __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 331 of file eventDisplay_shipLHC.py.

Constructor & Destructor Documentation

◆ __init__()

eventDisplay_shipLHC.IO.__init__ (   self)

Definition at line 332 of file eventDisplay_shipLHC.py.

332 def __init__(self):
333 self.master = tkinter.Tk()
334 self.master.title('SHiP Event Display GUI')
335 self.master.geometry(u'320x580+165+820')
336 self.fram1 = tkinter.Frame(self.master)
337 b = tkinter.Button(self.fram1, text="Next Event",command=self.nextEvent)
338 b.pack(fill=tkinter.BOTH, expand=1)
339 label = tkinter.Label(self.fram1, text='Event number:')
340 label["relief"] = tkinter.RAISED
341 entry = tkinter.Entry(self.fram1)
342 entry["foreground"] = "blue"
343 label.pack(side=tkinter.LEFT)
344 entry.pack(side=tkinter.RIGHT)
345 self.contents = tkinter.IntVar()
346 # set it to some value
347 self.n = 0
348 self.contents.set(self.n)
349 # tell the entry widget to watch this variable
350 entry["textvariable"] = self.contents
351 # and here we get a callback when the user hits return.
352 # we will have the program print out the value of the
353 # application variable when the user hits return
354 entry.bind('<Key-Return>', self.nextEvent)
355 self.lbut = {}
356 x = 'withMC'
357 a = tkinter.IntVar()
358 if globals()['withMCTracks']: a.set(1)
359 else: a.set(0)
360 self.lbut[x] = tkinter.Checkbutton(self.master,text="with MC Tracks",compound=tkinter.LEFT,variable=a)
361 self.lbut[x].var = a
362 self.lbut[x]['command'] = self.toogleMCTracks
363 self.lbut[x].pack(side=tkinter.TOP)
364 self.geoscene = ROOT.gEve.GetScenes().FindChild("Geometry scene")
365 for v in top.GetNodes():
366 x=v.GetName()
367 cmd = 'toogle("'+x+'")'
368 a = tkinter.IntVar()
369 assemb = "Assembly" in v.GetVolume().__str__()
370 if v.IsVisible() or (assemb and v.IsVisDaughters()): a.set(1)
371 else : a.set(0)
372 self.lbut[x] = tkinter.Checkbutton(self.master,text=x.replace('_1',''),compound=tkinter.LEFT,variable=a)
373 self.lbut[x].var = a
374 self.lbut[x]['command'] = lambda j=x: self.toogle(j)
375 self.lbut[x].pack(side=tkinter.BOTTOM)
376 self.fram1.pack()
377# add ship actions to eve display
378 gEve = ROOT.gEve
379 slot = ROOT.TEveWindow.CreateWindowInTab(gEve.GetBrowser().GetTabLeft())
380 slot.SetShowTitleBar(ROOT.kFALSE)
381 packs = slot.MakePack();
382 packs.SetShowTitleBar(ROOT.kFALSE);
383 packs.SetElementName("SHiP actions")
384 packs.SetHorizontal()
385 slot = packs.NewSlot()
386 frame = slot.MakeFrame()
387 frame.SetElementName("commands")
388 frame.SetShowTitleBar(ROOT.kFALSE)
389 cf = frame.GetGUICompositeFrame()
390 hf = ROOT.TGVerticalFrame(cf)
391 hf.SetCleanup(ROOT.kLocalCleanup)
392 hf.SetWidth(150)
393 cf.AddFrame(hf)
394 guiFrame = ROOT.TGVerticalFrame(hf)
395 hf.AddFrame(guiFrame, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
396 guiFrame.SetCleanup(ROOT.kDeepCleanup)
397 b = ROOT.TGTextButton(guiFrame, "Add particle follower")
398 b.SetWidth(150)
399 b.SetToolTipText('start new window with top projection and energy loss')
400 b.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_addParticleFollower.py")')
401 guiFrame.AddFrame(b, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
402 bn = ROOT.TGTextButton(guiFrame, "fill histogram")
403 bn.SetWidth(150)
404 bn.SetToolTipText('Fill histogram with energy along flight path')
405 bn.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_fillEnergy.py")')
406 guiFrame.AddFrame(bn, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
407 bt = ROOT.TGTextButton(guiFrame, "switch transparent mode on/off")
408 bt.SetWidth(150)
409 bt.SetToolTipText('switch transparent mode on/off for better visibility of tracks')
410 bt.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_transparentMode.py")')
411 guiFrame.AddFrame(bt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
412 bnx = ROOT.TGTextButton(guiFrame, "next event")
413 bnx.SetWidth(150)
414 bnx.SetToolTipText('click for next event')
415 bnx.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_nextEvent.py")')
416 guiFrame.AddFrame(bnx, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
417 bzt = ROOT.TGTextButton(guiFrame, "synch zoom top->side")
418 bzt.SetWidth(150)
419 bzt.SetToolTipText('synchronize zoom top with side')
420 bzt.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_synchZoomt.py")')
421 guiFrame.AddFrame(bzt, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
422 bzs = ROOT.TGTextButton(guiFrame, "synch zoom side->top")
423 bzs.SetWidth(150)
424 bzs.SetToolTipText('synchronize zoom side with top')
425 bzs.SetCommand('TPython::ExecScript("'+os.environ['FAIRSHIP']+'/macro/evd_synchZooms.py")')
426 guiFrame.AddFrame(bzs, ROOT.TGLayoutHints(ROOT.kLHintsExpandX))
427#
428 cf.MapSubwindows()
429 cf.Layout()
430 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

Member Function Documentation

◆ nextEvent()

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

Definition at line 431 of file eventDisplay_shipLHC.py.

431 def nextEvent(self,event=None):
432 i = int(self.contents.get())
433 if i==self.n: self.n+=1
434 else : self.n=i
435 self.contents.set(self.n)
436 SHiPDisplay.NextEvent(self.n)

◆ toogle()

eventDisplay_shipLHC.IO.toogle (   self,
  x 
)

Definition at line 448 of file eventDisplay_shipLHC.py.

448 def toogle(self,x):
449 v = top.GetNode(x)
450 assemb = "Assembly" in v.GetVolume().__str__()
451 if v.IsVisible()>0 or assemb and v.IsVisDaughters()>0 :
452 print("switch off ",x)
453 v.SetVisibility(0)
454 v.SetVisDaughters(0)
455 self.lbut[x].var.set(0)
456 else:
457 print("switch on ",x)
458 if assemb: v.SetVisDaughters(1)
459 else: v.SetVisibility(1)
460 self.lbut[x].var.set(1)
461 gEve.ElementChanged(self.geoscene,True,True)
462 for v in top.GetNodes():
463 x = v.GetName()
464 if x in self.lbut:
465 assemb = "Assembly" in v.GetVolume().__str__()
466 if v.IsVisible()>0 or assemb and v.IsVisDaughters()>0 : self.lbut[x].var.set(1)
467 else : self.lbut[x].var.set(0)
468#

◆ toogleMCTracks()

eventDisplay_shipLHC.IO.toogleMCTracks (   self)

Definition at line 437 of file eventDisplay_shipLHC.py.

437 def toogleMCTracks(self):
438 tl = fRun.GetMainTask().GetListOfTasks()
439 geoTask = tl.FindObject("GeoTracks")
440 if globals()['withMCTracks']:
441 globals()['withMCTracks'] = False
442 self.lbut['withMC'].var.set(1)
443 if geoTask: geoTask.SetActive(0)
444 else:
445 globals()['withMCTracks'] = True
446 self.lbut['withMC'].var.set(0)
447 if geoTask: geoTask.SetActive(1)

Member Data Documentation

◆ contents

eventDisplay_shipLHC.IO.contents

Definition at line 345 of file eventDisplay_shipLHC.py.

◆ fram1

eventDisplay_shipLHC.IO.fram1

Definition at line 336 of file eventDisplay_shipLHC.py.

◆ geoscene

eventDisplay_shipLHC.IO.geoscene

Definition at line 364 of file eventDisplay_shipLHC.py.

◆ lbut

eventDisplay_shipLHC.IO.lbut

Definition at line 355 of file eventDisplay_shipLHC.py.

◆ master

eventDisplay_shipLHC.IO.master

Definition at line 333 of file eventDisplay_shipLHC.py.

◆ n

eventDisplay_shipLHC.IO.n

Definition at line 347 of file eventDisplay_shipLHC.py.

◆ nextEvent

eventDisplay_shipLHC.IO.nextEvent

Definition at line 354 of file eventDisplay_shipLHC.py.


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