GSI Go4 Online Offline Object Orientedweb-docs.gsi.de/~go4/go4gside/chep2001/chep2001.pdf ·...
Transcript of GSI Go4 Online Offline Object Orientedweb-docs.gsi.de/~go4/go4gside/chep2001/chep2001.pdf ·...
04.09.01 Go4 - http://go4.gsi.de 1
J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel
CHEP 2001
Multithreaded Inter-Task Communication with ROOT -writing non-blocking GUIs
GSIOnlineOfflineObjectOriented
Go4
04.09.01 Go4 - http://go4.gsi.de 2
Contents
• Go4: Software layers and architecture
• Go4 Requirements
• Multithreading (threadmanager library)
• Inter task communication (taskhandler library)
• Example: GUI task and analysis task
• GUI implemetation with ROOT-Qt Interface
• Demo (movie)
• Summary
04.09.01 Go4 - http://go4.gsi.de 3
Go4 Package Layers
ROOT FrameworkTThread
Go4 GUI (Server)
Go4 Event Analysis Loop (Client)
Qt LibraryInterface
Go4TaskHandler
Go4ThreadManager
04.09.01 Go4 - http://go4.gsi.de 4
Requirements of Go4
On-line Analysis with non blocking GUI
• Analysis based on ROOT
• Analysis runs permanently
• Analysis updates graphics asynchronously
• GUI is never blocked
• GUI controls and steers analysis
04.09.01 Go4 - http://go4.gsi.de 5
• Multithreading necessary
• ROOT classes not inherently thread save
���� lock object creation and ROOT services
���� nonblocking GUI and analysis: different tasks
• Communication between tasks
Problems to solve
Threadmanager library
Taskhandler library
04.09.01 Go4 - http://go4.gsi.de 6
Go4 Multitasking system
• Only one working thread per task(object creation, memory allocation, ROOT system calls)
• Analysis and GUI in separate tasks(non blocking GUI, continuous analysis)
• Communication:
• raw socket transport(dedicated threads with TBuffer fields in TGo4Socket)
• Object streaming by ROOT(working thread uses TGo4Queue methods)
04.09.01 Go4 - http://go4.gsi.de 7
Functional overview
CommandThread
StatusThread
DataThread
CommandThread
StatusThread
DataThread
WorkThread
WatcherThread
LoggingThread
ConnectorThread
LaunchThread
GUIUseraction
DataLoop
queu
e
queu
e
queu
e
queu
e
queu
e
queu
e
IP Network
DrawingThread
Display Task (Server)
Analysis Tasks (Client 1,2,...)
Task
Han
dler
Task
Han
dler
04.09.01 Go4 - http://go4.gsi.de 8
Go4 GUI
• Complex GUI• Rapid prototyping
• Go4 GUI architecture:– signal-slot mechanism (both Qt and ROOT)
– gui singleton: registry + dispatcher (modified mediator pattern)
– persistent status objects per window
Qt graphics libraryprofessional, powerful, free,tools (QtDesigner), well documented
}
• Use ROOT and Qt together!no changes to ROOT sources
04.09.01 Go4 - http://go4.gsi.de 9
QROOTApplication
QTimer
TQROOTCanvasQWidget
TCanvas
TQROOTCanvasQWidget
TCanvas
TQROOTCanvasQWidget
TCanvas
QApplication
Go4 GUI: Qt-ROOT interface
Qt Eventloop
QApplication::Exec()
ROOT EventloopTSystem::InnerLoop()
TApplicationTQApplication
TRootGuiFactory
TQRootGuiFactory
TCanvasImpTQCanvasImp
TTimer TThread
TSocket other...QWidgetQWidget
04.09.01 Go4 - http://go4.gsi.de 10
Go4 GUI: Qt-ROOT interface
• Follows the general ROOT GUI ABC– no changes in ROOT source necessary
• Inheritance from ROOT base classes– TQRootGuiFactory (TRootGuiFactory)
– Qt Factory GUI components– TQCanvasImp (TCanvasImp)
– creates a Qt independent main window (QMainWindow)
– sets TQRootCanvas as a central widget
– TQApplication (TApplication)– ROOT environment set with a Qt GUI factory
• Inheritance from Qt base class– QRootApplication (QApplication)
– enable Qt evt-loop to drive Qt based GUI applications
– call ROOT inner loop repeatedly to enable ROOT system events
04.09.01 Go4 - http://go4.gsi.de 11
Qt Designer screenshot
04.09.01 Go4 - http://go4.gsi.de 12
Using Qt designer
04.09.01 Go4 - http://go4.gsi.de 13
Qt GUI
Widgets
StatusSlots
Root GUI
Widgets
StatusSlots
GUISingletonregistry
command dispatcherstatus mediator
Go4 GUI design
Displaytaskhandler
server
update
commands
register(dependency)
data IP
to analysis
Qt GUI
Widgets
StatusSlots
Qt GUI
Widgets
StatusSlots
04.09.01 Go4 - http://go4.gsi.de 14
Summary
• Go4 thread manager package
• Go4 task handler package
• Go4 Qt-ROOT interface
ready to use for any ROOT application
• Client task could be analysis framework, slow ctrl,...
• GUI task can use Qt graphics library
• Go4 analysis framework and GUI is being under development...
http://go4.gsi.de
04.09.01 Go4 - http://go4.gsi.de 15
Go4 demo
localobjects
Control panel
monitoredhistograms
remoteobjects
analysisstatus
ROOTcanvas
04.09.01 Go4 - http://go4.gsi.de 16
Go4 demo
• Initializing a remote analysis
• Control of analysis: run status, list object folders
• Monitor remote histograms continuously
• Get and update local object copies
• Working on local histograms (fit panel, save)
• ROOT TBrowser works in parallel
• Go4 Browser plots: superimpose, multiwindow
04.09.01 Go4 - http://go4.gsi.de 17
Go4 demo
04.09.01 Go4 - http://go4.gsi.de 18
Go4 demo
04.09.01 Go4 - http://go4.gsi.de 19
Go4 demo
04.09.01 Go4 - http://go4.gsi.de 20
Go4 demo
04.09.01 Go4 - http://go4.gsi.de 21
Go4 demo
regular ROOT TBrowser,works together with Qt
04.09.01 Go4 - http://go4.gsi.de 22
Go4 demo