Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using the Qt to create complex interactive HENP applications at STAR by V.Fine, J.Lauret, V.Perevoztchikov.

Similar presentations


Presentation on theme: "Using the Qt to create complex interactive HENP applications at STAR by V.Fine, J.Lauret, V.Perevoztchikov."— Presentation transcript:

1 Using the Qt to create complex interactive HENP applications at STAR by V.Fine, J.Lauret, V.Perevoztchikov

2 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 2 Introduction This talk presents an overview of the main components of a unique set of tools, in use in the STAR experiment, born from the fusion of two advanced technologies: the ROOT framework and libraries and the Qt GUI and event handling package

3 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 3 Can we afford third party package ? “bad packages” use case Use case: One needs 100 different small functions (wish list) There are 100 different packages (free) each implements one function from the wish-list above Question: Does it worth to install and maintain 100 different packages to get (free :) those 100 functions or one should implement (re-implement) those functions on his / her own ? One needs extremely strong reason to go the former way

4 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 4 Can we afford third party package ? “good package” use case Use case: One still needs 100 different small functions (wish list) There is one single package that provides 100 different functions all those functions are on one's wish list Question: Does it worth to install and maintain such package? One needs extremely strong reason to reject the package in question

5 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 5 Cost to maintain vs “re-use” gain: ”good package” case Functionality % Cost to maintain “re-use gain” 0 100 Cost to maintain “re-use” gain How to increase the gain: Increase the “re-use” Decrease the cost of ownership “gain”

6 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 6 ROOT and Qt are a “good packages” Together (see impressive #61 GO4 talks also), ROOT and Qt allow creating software packages and help resolving complex data-analysis or visualization problems, enhance computer simulation or help develop geometry models demonstrating that it is not only feasible, but beneficial to integrate and benefit from the best of each technology.

7 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 7 We (@STAR) were not first one (see http://root.bnl.gov )http://root.bnl.gov The core library and system has been under development for the last 4 years and has solidified and made into concrete use through several applications for the STAR experiment at BNL as well as ROOT plugins. As a result, STAR has been empowered with stable interactive applications for online control and offline data-analysis built on the top of the STAR ROOT-based framework and this, while preserving the initial software components in a non disruptive manner.

8 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 8 Qt Root In fact, many components are not STAR specific and can be re-used or used in the context of “user custom filters”, “detector geometry” components or even various 3D views for the High Energy and Nuclear Physics events

9 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 9 Distribution The portion of the project is already included in the official ROOT distribution and part of LCG binary distribution of the ROOT package for RHIC and LHC experiments. In full it is available from http://root.bnl.gov Web site.http://root.bnl.gov Binary “InstallShield”-based installation for Windows is available from that page also.

10 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 10 Components The project contains the set of the "user” components and tools of QtRoot layer to facilitate: Creation the Qt-based ROOT application and shared library; The ROOT-based Qt-application; Using Qt GUI "designer" and Qt "project file“; generating the class HTML (THtml) documentation of the Qt/Root-based user classes; ROOT-based and stand-alone QtRoot layer installation Embedding 2D and 3D Qt widgets rendering the ROOT graphical objects. Qt signal / slot – ROOT signal / signal slot bidirectional mapping

11 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 11 TGQt – Qt-based implementation of TVirtualX – the core of QtRoot Qt-ROOT implementation of TVirtualX (Qt-layer) provides a convenient way of creating complex end-user applications requiring both Qt GUI and ROOT features. The primary goal is to allow “seamless embedding” into Qt applications the ROOT GUI and visualization Components defined with the ROOT plugin mechanism TGQt ROOT class, a Qt-based implementation of TVirtualX interface is an optional ROOT component. Supported by the STAR collaboration’s S&C The history of the project and the QtRoot technical implementation details –presented at ACAT 2002 (Moscow) –ACAT 2003 (Tsukuba).

12 TVirtualX TGQt QObject TQtClientFilter TGQt::CreateWindow(…) TGQt::Init(…) QWidget::installEventFilter QFrame TQtClientWidget QWidget QPtrQueue fRootEventQueue TGQt::NextEvent() TGClient::ProcessOneEvent Event_tQEvent Transformation the QEvent Q-object into the ROOT Event_t structure QWidget TQtWidget TGQt::InitWindow(…) method “Clear boxes” show the overloaded methods of the TVirtualX interface Class name “Gray boxes” show the Classes inheritance diagram TGQt::OpenPixmap() QPixmap

13 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 13 TVirtualX implementations The current official ROOT provide 3 different implementations of the TVirtualX interface (see Fons’ talk). The size (lines of the C++/C code) of these implications: win32gdk40000Win32 ( Windows 9x/NT/XP ) x117100X11 (Unix, MacOS, cygwin) qt6900Win32 / X11 / Mac native / Qt3 and Qt4 (no user support for Qt4 yet) One still needs cleaning TGQt up further to remove the code used to debug it TGQt - one single code for all platforms: no #ifdef, no single/multithread games seen with other implementations

14 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 14 “Split” repository At the moment the project is “split” by two separate CVS Repositories: “Qt layer” and “Qt Extension” The full version that “Qt-layer” + “Qt Extension” is available from BNL CVS Repository –CVSROOT :pserver:cvsuser@cvs.bnl.gov:/date01/CVS –Web (STAR): http://root.bnl.gov http://root.bnl.gov –Mail list: qt-root-l@lists.bnl.gov qt-root-l@lists.bnl.gov The “Qt-layer” is a part of the official ROOT repository. See: http://root.cern.ch http://root.cern.ch

15 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 15 Two QtRoot end-user “use cases” TWin32Gdk Even though the TGQt class is a “soul” of the Qt layer it just implements at the TVirtualX interface and is normally hidden from the end-user code 1.Qt-based ROOT applications use “TCanvas” 2.ROOT-based Qt application use TQtWidget TQtGLViewerWidget BNL CVS Repository

16 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 16 Use case: “Qt-based ROOT applications” “ROOT application” is the application that either instantiates the ROOT TApplication / TRint class and enters the ROOT event loop or is the shared library that can be loaded into the already running ROOT application via TSystem::Load method or via ROOT plug-in mechanism. You must neither initialize Qt QApplication nor enter the Qt event loop. Qt- layer takes care about both of these steps. What you need is just to instantiate the Qt object of your choice and keeps playing ROOT rules.

17 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 17 Use case: “ROOT-based Qt applications” “Qt application” is the application that either instantiates the Qt QApplication and enters the Qt event loop or is the shared library that can be loaded into the already running Qt application via Qt plug-in mechanism. You must neither initialize ROOT TApplication / TRint nor enter the ROOT event loop. Qt-layer takes care about both of these steps. What you need is just to instantiate the embedded and regular ROOT objects of your choice and keep playing Qt rules.

18 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 18 Qt/Root integration To increase the gain we should to integrate Root and Qt as much as possible and preserver the ROOT integrity, This is possible thanks th unique ROOT Plugin mechanism and modular OO design. Qt components -> native ROOT plugin (shared libraries) ROOT GUI component -> native " Qt primitives This means: TCanvas is represent by QWidget TPad is represented by QPixmap TImage is backed by QImage etc

19 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 19 Benefits One can include third party Qt GUI components and packages into both cases Coin3D GO4 Qwt QGLViewer

20 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 20 2D ROOT graphics: TQtWidget – QWidget for embedded TCanvas Can be used with Qt “designer” Provided with a bunch of the proxy-methods to access the embedded TCanvas object Provided with the convenient Qt signals to notify the client code about the object selection, mouse events and interactions Can be subclassed to meet some special needs.

21 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 21 Simple histogram browser (60 lines of C++ code) GO4 “design”

22 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 22 3D ROOT graphics – QtGLViewerWidget Can be used with Qt “designer” Very simple the end-user interface to pass the “GL list” to be rendered Provided with the convenient Qt signals to notify about the GL object selection Can be sub-classed to meet some customer needs also

23 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 23 Qt implementation of ROOT 3D viewer interface classical: Model-View-Controller TVirtualViewer3D ROOT > 4.01 (ROOT > 4.01) TQtRootViewer3D TQtGLViewer TGLViewer ROOT < 4.01 (ROOT < 4.01) TPad TObject GL list Coin Node model controllerview TQtGLViewerWidget QGLWidget QGLViewer QWidget GL attrib GL list ROOT plug-in

24 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 24 Combination of the different GL attributes Original Original + wired Solid + wired Solid Wired “Sliced” The number of possible combinations and its complexity are unlimited

25 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 25 Qt 3D features No “soft” matrix / coordinate transformations –it is as fast as your GL video hardware One to one “model-matrix” “view-matrix”, “model-points” “view-points”, “hierarchical model” “hierarchical view” –Trivial navigation “model->view” and “view->mode” –Change the model does entail change neither in the controller not in view source code –“Controller” and “view” implementations are trivial, therefore it is robust and stable Unlimited number of the simultaneously rendered views / sub- views / widgets / objects No user’s model (TObject for example) pointer needed –The destruction of the model does not entail the viewer crash and versa verse. Functionality satisfies the most STAR collaboration requirements

26 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 26 Click mouse action of QGLViewer

27 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 27 Mouse action of QGLViewer

28 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 28 3D selection and highlighting “Full” wired Status bar ROOT context menu Satellite widget

29 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 29 3D customization Is trivial and it is defined by the Qt and QGLViewer implementation, “philosophy” and design 3D viewer attributes – base class –Use – predefined subclasses –Subclass yourself and use Rendering –Ask controller to generate the view for the “known” ROOT classes –Provide your own custom view factory for your class or for the “know” ROOT class –Provide the Qt slot to respond the “QGLViewer “draw” Qt signal Selection ( like “Rendering”) –Provide the Qt slot to respond to the QGLViewer “select” signal Provide your own “controller”/”view”

30 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 30 ROOT resource parameters Plugin.TVirtualPadEditor: Ged TQtGedEditor QtGed "TQtGedEditor(TCanvas*)" Plugin.TPaletteEditor: * TQtPaletteEditor QtImage "TQtPaletteEditor(TAttImage*,UInt_t,UInt_t)“ Plugin.TImage: * TQtImage QtImage "TQtImage()“ # GUI specific settings Gui.Style: windows | native | motif | platinum | etc... Gui.Backend: qt | native Gui.Factory: qtgui | native | qt Plugin.TVirtualX: qt TGQt GQt "TGQt(const char*,const char*)" Plugin.TGuiFactory: qtgui TQtGUIFactory QtGui "TQtGUIFactory()" Plugin.TVirtualViewer3D: ogl TQtRootViewer3D RQTGL "TQtRootViewer3D(TVirtualPad*)" All plugins but TVirtualX are optional

31 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 31 “HelloWord” examples: HelloWord - Qt-based ROOT application (see p.362) HelloCanvas - ROOT-based Qt-application (see p.362) HelloCint(*) - ROOT-based shared library (see p.363) ex1 - the simple ROOT-based Qt-applciation built automatically with qt "designer" (see: p.364) QtGBrowser(*) - "Advanced version of Qt application build with the Qt "designer“ CustomWidgets(*) CustomCanvasMenu

32 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 32 Installation ROOT bundle./configure […] --enable-qt make Stand-alone, either from ROOT CVS or from full version BNL CVS (against an arbitrary not too old ROOT version) qmake [.pro] make See : http://root.bnl.govhttp://root.bnl.gov

33 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 33 Qt project and Qt designer Qt designer Import the pre-defined Qt “Custom widget” definition: $ROOTSYS/include/TQtWidget.cw $ROOTSYS/include/TQtGLViewerWidget.cw Qt “qmake” utility Include the qmake include file into your project $ROOTSYS/include/rootcint.pri

34 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 34 Documentation tools On-line documentation is prepared with the ROOT THtml class. In addition there is a script to post- process the output of the THtml class. It replaces all references of the Qt classes with the proper hyperlinks to TrollTech or QGLViewer online documentation. To be useful for the other application as well. Since ROOT 4.04 the ROOT User’s Manual contains the “Qt” section.

35 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 35 STAR “Event Displays” Online event display: Web broadcast the real-time STAR events 24 x 7 during the RUN 2005 (Run 2006 coming next month Offline “Event display”: used to debug the STAR reconstruction and analysis codes

36 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 36 Readiness Works on UNIX and “native” Mac. It was tested on Windows with ROOT 4.00.08. 2D / 3D Qt Root widget are working and stable ROOT GUI needs work inside TGQt class that affects no end-user interface In other words, QtRoot interface is stable and it is safe to use it within Qt-based applications.

37 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 37 From the single source code X11 win32gdk Qt native Qt X11 (cygwin) UNIX Mac Windows

38 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 38 To Do Find and fix the remaining bugs Negotiate with ROOT team to adopt more project “pieces” Add QtThreadImp class to the official CERN distribution. More Qt Proxy for ROOT Editor classes Integrate ROOT “ql” view etc (ROOT is fast evolving project after all)

39 Feb 15, 2006CHEP’06, Mumbai V.Fine, JLauret, V.Perevoztchikov 39 References CINT status, Masa Goto http://www.slac.stanford.edu/BFROOT/www/Computing/Distributed/ROOT2004/files/goto.ppt Cross-platform approach to create the interactive application based on ROOT and Qt GUI libraries. http://www-conf.kek.jp/acat03/prog/presen/id0112.ppt ROOT in GO4, Joern Adamczewski http://www.slac.stanford.edu/BFROOT/www/Computing/Distributed/ROOT2004/files/adamczewski.ppt http://www.slac.stanford.edu/BFROOT/www/Computing/Distributed/ROOT2004/files/adamczewski.ppt Cross-platform Qt-based implementation of low level GUI layer of ROOT http://acat02.sinp.msu.ru/presentations/fine/Acat2002.ppt Cross-platform approach to create the interactive application based on ROOT and Qt GUI libraries http://www-conf.kek.jp/acat03/prog/presen/id0112.ppt Visualization of the ROOT 3D class objects with Open Inventor-like viewers http://www-conf.kek.jp/acat03/prog/presen/id0113.ppt C++ GUI Programming with Qt3 http://phptr.com/content/images/0131240722/downloads/blanchette_book.pdf ROOT 4.04 User’s Manual


Download ppt "Using the Qt to create complex interactive HENP applications at STAR by V.Fine, J.Lauret, V.Perevoztchikov."

Similar presentations


Ads by Google