# Presentation: 197836

## V.Fine

- The STAR “Integrated" Geometry Browser

##  How to start the Browser 

- To start the STAR Geometry browser use 3 shell commands:
**> stardev**
**> source $STAR/QtRoot/qtgl/qtcoin/setup.csh**
**> root4star GeomBrowse.C**

- The browser requires the Qt ROOT plug-in to be activated instead of the “X11” plug-in which is ROOT default. To change the default, one has to provide the custom _[“.](file:///.rootrc)__[rootrc](file:///.rootrc)_” file as follows:

**Gui.Backend qt**
**Plugin.TGuiFactory  qtgui  TQtGUIFactory  QtRootGui  "TQtGUIFactory()"**
**Gui.Factory           qtgui**
**Plugin.TVirtualPadEditor  Ged TQtGedEditor   QtGed  "TQtGedEditor(TCanvas*)"**
**Plugin.TVirtualViewer3D  ogl    TQtRootViewer3D  RQTGL "TQtRootViewer3D(TVirtualPad*)"**
**+Plugin.TVirtualViewer3D  oiv   TQtRootCoinViewer3D  RQIVTGL    "TQtRootCoinViewer3D(TVirtualPad*)"**

- The **GeomBrowse.C** does check whether Qt plug-in has been activated and does create the proper “.rootrc” file for you if needed

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## Input 3D geometry formats

- Zebra                 - ***.fz**
- ROOT Macro     - ***.C**
- ROOT file          - ***.root**
- _["Open Inventor" ](http://en.wikipedia.org/wiki/Open_Inventor)_- ***.iv**, can be used  to combine
-         the ROOT/ GEANT objects with non-ROOT 3D shapes
- _[VRML](http://en.wikipedia.org/wiki/VRML)_                - ***.wrl**, can be used  to combine the ROOT/ GEANT objects with non-ROOT 3D shapes
- In the other words, all versions of the STAR detector geometry description for "GEANT Simulation" and "Reconstruction" can be visualized.

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## The output formats:

- All common pixmap formats: gif, png, jpg, tiff etc (can be used to create still and animated files)
- Postscript and Encapsulated PostScript
- VRML - Can be use to upload the 3D detector views
-         see: _[http://root.bnl.gov/QtRoot/svt.html](http://root.bnl.gov/QtRoot/svt.html)_. This format is useful for the Web-based application since it doesn’t require any access to local _[GPU](http://en.wikipedia.org/wiki/GPU)_
- "iv" - "Open Inventor2" - can be used to browse the STAR geometry and to create the high quality  pictures and animations with third party tools   like "Maya" _[http://](http://usa.autodesk.com/adsk/servlet/item?id=7635770&siteID=123112#Connectivity)__[usa.autodesk.com/adsk/servlet/item?id](http://usa.autodesk.com/adsk/servlet/item?id=7635770&siteID=123112#Connectivity)__[=7635770&siteID=123112#Connectivity](http://usa.autodesk.com/adsk/servlet/item?id=7635770&siteID=123112#Connectivity)_
-        In the other words the STAR GEANT geometry can be exported to be seen with no GEANT / ROOT involved.
- _[mpeg ](http://en.wikipedia.org/wiki/Mpeg)_(movie) to create the primitive movie.

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## GUI

- It provides the 3 different views of the STAR geometry:
- Tree-like (a'la "Internet Browser" )
-        For example:  _[http://](http://www.star.bnl.gov/STAR/comp/vis/GeomBrowser/TreeView.png)__[www.star.bnl.gov/STAR/comp/vis/GeomBrowser/TreeView.png](http://www.star.bnl.gov/STAR/comp/vis/GeomBrowser/TreeView.png)_
- _[QGLviewer](http://artis.imag.fr/Members/Gilles.Debunne/QGLViewer/index.html)__[ ](http://artis.imag.fr/Members/Gilles.Debunne/QGLViewer/index.html)_OpenGL view
-        For example:  _[http://www.star.bnl.gov/STAR/comp/vis/GeomBrowser/Activate3DViewers.png](http://www.star.bnl.gov/STAR/comp/vis/GeomBrowser/Activate3DViewers.png)_
- _[Coin3D](http://www.coin3d.org/)_ "Open Inventor" view.
-       For example: _[http://www.star.bnl.gov/STAR/comp/vis/GeomBrowser/Navigate3DViewers.png](http://www.star.bnl.gov/STAR/comp/vis/GeomBrowser/Navigate3DViewers.png)_
-     See: _[http://doc.coin3d.org/SoQt](http://doc.coin3d.org/SoQt)_
**          **_[http://doc.coin3d.org/SoQt/classSoQtExaminerViewer.html](http://doc.coin3d.org/SoQt/classSoQtExaminerViewer.html)_** **

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## GUI

- hold down **left mouse button** and move mouse pointer to rotate the camera around it's current focal point (the focal point can be changed by doing a seek operation)
- hold **middle mouse button** to pan (or a **CTRL**-key plus **left** mouse button, or a **SHIFT-key plus left** mouse button)
- hold **down left + middle mouse button** to zoom / dolly, or **CTRL + middle** mouse button, or **CTRL + SHIFT + the left mouse button**
- click **'s'**, then pick with the **left mouse button** to seek
**right mouse** button opens the popup menu
- click **'ESC'** key to switch to and from **'camera interaction**' mode and **'scenegraph interaction**' mode (see setViewing() documentation)
**'q**' quits the application
- Hitting any of the __ , __ or __ buttons in the panel on the left side of the rendered canvas will "flip" the current camera direction around it's focal point to point along the selected axis (towards negative infinity).
- Hitting any of the "cutted" ___, __ or __ buttons in the panel will position the so-called _[clip plane](http://doc.coin3d.org/Coin/classSoClipPlaneManip.html)_ at the center of the scene and orthogonal to the selected axis.
- The _[SoQtExaminerViewer](http://doc.coin3d.org/SoQt/classSoQtExaminerViewer.html)_ provides a user decoration's      button for toggling between orthographic or perspective camera view volumes and projection methods. This is the bottom-most click button on the right decoration border.
- It also inherits the decoration buttons from the _[SoQtFullViewer](http://doc.coin3d.org/SoQt/classSoQtFullViewer.html)_ on the right side:
- the arrow for switching to "scenegraph interaction" mode,
- the hand for setting back to "camera interaction" mode,
- the house for "reset camera to home position",
- the blueprint house for "set new camera home position",
- the eye for "zoom camera out to view full scene" and
- the flashlight for setting "click to seek" mode.

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## API

**1. ROOT API. **
-      The browser uses the standard ROOT plug-in mechanism.   This means to use it from within ROOT env to render   the ROOT 3D class objects no special API is required.  The TObject::Draw method will be served with the proper  plug-in  selected via ROOT resource file.
**2. Open Inventor API:**
-      To control things programmatically and to render the non-ROOT class objects one can use “Open Inventor” API  See: "
-        _[http://doc.coin3d.org/Coin/classes.html](http://doc.coin3d.org/Coin/classes.html)_  for details
-      The ROOT and non-ROOT objects (including Coin3D animated objects) can be mixed within one 3D scene.
**3. Qt API. **
-      The widget classes do provide the Qt signal / slot API. This allows using the GeomBrowser to create the custom Qt-based GUI, for example for the "Control Room" and to create the animated interactive computer models of the STAR detector useful for students, teaching and public presentations.
-      The widget emits the Qt signal as soon as the user "picks" some object. The signal provides a C++ pointer to the original ROOT object.

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## STAR detector geometry “providers”

**St_geom_Maker** – featured interactive “stand-alone” “GeomBrowse.C” ROOT macro to browse many types of the STAR detector  geometry definitions from Zebra files, ROOT files , ROOT macros, “Open Inventor” iv files, VRML files.
**St_geant_Maker** – TGeo, TVolume - “on fly”
**StiMaker** – Sti geometry “on fly”

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## Interactive 3D Object Selection

- Coin3D plug-in  is built around of the TQtCoinWidget class which is the Qt QWidget. (TQtCoinWidget is an equivalent of the TQtWidget class for the embedded TCanvas)
- The widget emits the Qt signal as soon as the user "picks" some object. The signal provides a C++ pointer to the original ROOT object that can be received by the user defined Qt slot to create the customized selected object manipulation.
- The viewer is equipped with two built-in slots to handle the selected object as well.

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## The Default Selection Slot

**To select object one has** **to**
- Turn the Coin viewer “selection”    tool on
- Use the left mouse button to point the image  on the 3D view
**The browser should**:
- Highlight the selected shape
- Popup the label with the text provided by the selected object TObject::GetObjectInfo method
- Find the object in the left tree pane of the Geometry Browser and select the found object there
- The object selected  in the “tree” list should be painted on the right upper TCanvas widget

**1**

**2**

**4**

**3**

**5**

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## The “Menu” Selection Slot

**The Browser provides another “selection” slot.**
- The SLOT is activated via the drop-down** “Options” **menu**.**
- To select the object user should follow the previous slide. The only difference, instead of the label the browser will pop the ROOT **“Context menu”**

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## The “GeomBrowse” Custom Selection

**The STAR Geometry Browser provides the custom selection slot in addition to the two built-in slots described above**
- The SLOT is activated via the icon**.**
- To select the object user should follow the previous slides. The only difference, **in addition** to the built-in action, the application is to popup the text edit window with the source code of the selected volume highlighted.

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## Animation

- The example of the using the “Open Inventor” ROOT Plug-in and the external files to animate the 3D rendering  can be found on the _[separate Web page](http://www.star.bnl.gov/STAR/comp/vis/iv/README.html)_

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## Multiply 3D widgets / attributes

- The Qt-based ROOT 3D plug-ins do allow creating as many OpenGL widgets as your local video hardware can sustain and set the video attributes for each widget separately as the _[short animation ](http://www.star.bnl.gov/STAR/comp/vis/animation/GeomBrowser3FilesDemo.wmv)__on the right demonstrates:_

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006

## Mixed ROOT / Coin3D 3D scene

- It is simple to create the ROOT objects with the  mixing ROOT 3D and Coin3D objects. For example the ROOT objects define the geometry (shapes, color and positions) and Coin3D define the animations, lighting, clipping, 3D labels etc. The mixed objects can be saved/ restored using the regular either ROOT (root file) or Coin3D (see slide 4) I/O

- The** rootgeom_coin.C** ROOT macro creates such object and renders it with non-Coin3D TCanvas and Coin3D ROOT plug-in. To see how it works you should set QtRoot/Coin env ( see slide 2)
**> stardev**
**> source $STAR/QtRoot/qtgl/qtcoin/setup.csh**
**> root.exe rootgeom_coin.C**

- http://www.star.bnl.gov/STAR/comp/vis/  S&C STAR weekly meeting.

- 12/6/2006