Logo ROOT   6.14/05
Reference Guide
geom_cms_stereo.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_eve
3 /// Shows CMS geometry in stereo mode.
4 /// This requires quad-buffer support in the OpenGL hardware / driver,
5 /// otheriwse a fatal error occurs.
6 ///
7 /// \image html eve_geom_cms_stereo.png
8 /// \macro_code
9 ///
10 /// \author Matevz Tadel
11 
12 void geom_cms_stereo(Bool_t quad_buf=kTRUE)
13 {
15 
17  gGeoManager = gEve->GetGeometry("http://root.cern.ch/files/cms.root");
19 
20  TGeoVolume* top = gGeoManager->GetTopVolume()->FindNode("CMSE_1")->GetVolume();
21 
22  TEveGeoTopNode* trk = new TEveGeoTopNode(gGeoManager, top->FindNode("TRAK_1"));
23  trk->SetVisLevel(6);
24  gEve->AddGlobalElement(trk);
25 
26  TEveGeoTopNode* calo = new TEveGeoTopNode(gGeoManager, top->FindNode("CALO_1"));
27  calo->SetVisLevel(3);
28  gEve->AddGlobalElement(calo);
29 
30  TEveGeoTopNode* muon = new TEveGeoTopNode(gGeoManager, top->FindNode("MUON_1"));
31  muon->SetVisLevel(4);
32  gEve->AddGlobalElement(muon);
33 
34  // --- Stereo ---
35 
36  TEveWindowSlot* slot = 0;
38 
39  TEveViewer* sv = new TEveViewer("Stereo GL", "Stereoscopic view");
40  sv->SpawnGLViewer(gEve->GetEditor(), kTRUE, quad_buf);
41  sv->AddScene(gEve->GetGlobalScene());
42 
43  slot->ReplaceWindow(sv);
44 
45  gEve->GetViewers()->AddElement(sv);
46 
48 
49  // --- Redraw ---
50 
52  gEve->EditElement(sv);
53 
54  // --- Fix editor ---
55 
56  // EClipType not exported to CINT (see TGLUtil.h):
57  // 0 - no clip, 1 - clip plane, 2 - clip box
62  v->RefreshPadEditor(v);
63 
64  v->CurrentCamera().RotateRad(-1.2, 0.5);
65  v->DoDraw();
66 }
TGLClipSet * GetClipSet() const
Definition: TGLViewer.h:264
void SetClipType(TGLClip::EType type)
Set current clip active in viewer - 'type' is one of kClipNone kClipPlane or kClipBox.
Definition: TGLClip.cxx:580
static TEveWindowSlot * CreateWindowInTab(TGTab *tab, TEveWindow *eve_parent=0)
Create a new tab in a given tab-widget and populate it with a default window-slot.
void EditElement(TEveElement *element)
Show element in default editor.
TEveBrowser * GetBrowser() const
Definition: TEveManager.h:137
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
void AddGlobalElement(TEveElement *element, TEveElement *parent=0)
Add a global element, i.e.
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Definition: TFile.h:315
void DoDraw(Bool_t swap_buffers=kTRUE)
Draw out the viewer.
Definition: TGLViewer.cxx:550
Description of TEveWindowSlot.
Definition: TEveWindow.h:301
virtual Bool_t RotateRad(Double_t hRotate, Double_t vRotate)
Rotate camera around center.
Definition: TGLCamera.cxx:927
bool Bool_t
Definition: RtypesCore.h:59
TGLCamera & CurrentCamera() const
Definition: TGLViewer.h:269
void ReplaceWindow(TEveWindow *w)
Replace this window with the passed one.
Definition: TEveWindow.cxx:819
TEveViewerList * GetViewers() const
Definition: TEveManager.h:145
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
A wrapper over a TGeoNode, possibly displaced with a global trasformation stored in TEveElement...
Definition: TEveGeoNode.h:92
TGeoManager * GetGeometry(const TString &filename)
Get geometry with given filename.
TEveScene * GetGlobalScene() const
Definition: TEveManager.h:147
SVector< double, 2 > v
Definition: Dict.h:5
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
void DefaultColors()
Set default volume colors according to A of material.
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition: TGTab.cxx:507
TEveGedEditor * GetEditor() const
Returns main object editor.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:53
TGLViewer * GetDefaultGLViewer() const
Get TGLViewer of the default TEveViewer.
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
const Bool_t kFALSE
Definition: RtypesCore.h:88
void SetVisLevel(Int_t vl)
Definition: TEveGeoNode.h:115
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:562
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
TGLColor & Background()
Definition: TGLUtil.h:849
virtual void RefreshPadEditor(TObject *obj=0)
Update GED editor if it is set.
Definition: TGLViewer.cxx:2278
void SetGuideState(Int_t axesType, Bool_t axesDepthTest, Bool_t referenceOn, const Double_t *referencePos)
Set the state of guides (axes & reference markers) from arguments.
Definition: TGLViewer.cxx:2061
TGLColorSet & ColorSet()
Definition: TGLViewer.h:236
virtual void AddElement(TEveElement *el)
Call base-class implementation.
Definition: TEveViewer.cxx:358
TGeoVolume * GetTopVolume() const
Definition: TGeoManager.h:503
void SetColor(Int_t r, Int_t g, Int_t b, Int_t a=255)
Set color with Int_t values.
Definition: TGLUtil.cxx:1258
const Bool_t kTRUE
Definition: RtypesCore.h:87
TGeoNode * FindNode(const char *name) const
search a daughter inside the list of nodes
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:94
Eve representation of TGLViewer.
Definition: TEveViewer.h:30