220 likes | 240 Views
CHEP 2001. G SI O nline O ffline O bject O riented. G o 4. Multithreaded Inter-Task Communication with ROOT - writing non-blocking GUIs. J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel. Contents. G o 4 : Software layers and architecture G o 4 Requirements
E N D
CHEP 2001 GSIOnlineOfflineObjectOriented Go4 Multithreaded Inter-Task Communication with ROOT - writing non-blocking GUIs J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel Go4 - http://go4.gsi.de
Contents • Go4: Software layers and architecture • Go4Requirements • Multithreading (threadmanager library) • Inter task communication (taskhandler library) • Example: GUI task and analysis task • GUI implemetation with ROOT-Qt Interface • Demo (movie) • Summary Go4 - http://go4.gsi.de
Go4 Package Layers Go4 Event Analysis Loop (Client) Go4 GUI (Server) Go4TaskHandler Qt Library Go4ThreadManager Interface TThread ROOT Framework Go4 - http://go4.gsi.de
Requirements ofGo4 • 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 Go4 - http://go4.gsi.de
Problems to solve • Multithreading necessary • ROOT classes not inherently thread save • lock object creation and ROOT services • nonblocking GUI and analysis: different tasks • Communication between tasks Threadmanager library Taskhandler library Go4 - http://go4.gsi.de
Go4Multitasking 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) Go4 - http://go4.gsi.de
Functional overview Display Task (Server) GUI LoggingThread DrawingThread Useraction queue queue queue LaunchThread Task Handler CommandThread DataThread StatusThread ConnectorThread IPNetwork DataThread CommandThread StatusThread DataLoop Task Handler queue queue queue Analysis Tasks (Client 1,2,...) WorkThread WatcherThread Go4 - http://go4.gsi.de
Use ROOT and Qt together!no changes to ROOT sources Qt graphics library professional, powerful, free, tools (QtDesigner), well documented Go4GUI • 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 Go4 - http://go4.gsi.de
Qt Eventloop QApplication::Exec() ROOT Eventloop QWidget QWidget QTimer TSystem::InnerLoop() QWidget QWidget QWidget TQROOTCanvas TQROOTCanvas TQROOTCanvas TRootGuiFactory TCanvas TCanvas TCanvas TQRootGuiFactory TCanvasImp TQCanvasImp Go4 GUI: Qt-ROOT interface QApplication TApplication QROOTApplication TQApplication TTimer TThread TSocket other... Go4 - http://go4.gsi.de
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 Go4 - http://go4.gsi.de
Qt Designer screenshot Go4 - http://go4.gsi.de
Using Qt designer Go4 - http://go4.gsi.de
Root GUI IP Qt GUI Qt GUI Qt GUI Widgets Widgets Widgets Widgets Slots Slots Slots Slots Status Status Status Status Go4GUI design GUISingleton registry command dispatcher status mediator commands Display taskhandler server data to analysis • register • (dependency) update Go4 - http://go4.gsi.de
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 Go4 - http://go4.gsi.de
Go4 demo monitored histograms ROOT canvas Control panel analysis status local objects remote objects Go4 - http://go4.gsi.de
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 Go4 - http://go4.gsi.de
Go4 demo Go4 - http://go4.gsi.de
Go4 demo Go4 - http://go4.gsi.de
Go4 demo Go4 - http://go4.gsi.de
Go4 demo Go4 - http://go4.gsi.de
Go4 demo regular ROOT TBrowser, works together with Qt Go4 - http://go4.gsi.de
Go4 demo Go4 - http://go4.gsi.de