Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MultiView.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Multi-view (3d, rphi, rhoz) service class using EVE Window Manager.
4/// Used together with alice_esd.C macro
5///
6/// \macro_code
7///
8/// \author Matevz Tadel
9
10#include <TEveManager.h>
11
12#include <TEveViewer.h>
13#include <TGLViewer.h>
14
15#include <TEveScene.h>
16
18#include <TEveProjectionAxes.h>
19
20#include <TEveBrowser.h>
21#include <TEveWindow.h>
22
23// MultiView
24//
25// Structure encapsulating standard views: 3D, r-phi and rho-z.
26// Includes scenes and projection managers.
27//
28// Should be used in compiled mode.
29
30struct MultiView {
31 TEveProjectionManager *fRPhiMgr;
32 TEveProjectionManager *fRhoZMgr;
33
34 TEveViewer *f3DView;
35 TEveViewer *fRPhiView;
36 TEveViewer *fRhoZView;
37
38 TEveScene *fRPhiGeomScene;
39 TEveScene *fRhoZGeomScene;
40 TEveScene *fRPhiEventScene;
41 TEveScene *fRhoZEventScene;
42
43 //---------------------------------------------------------------------------
44
45 MultiView()
46 {
47 // Constructor --- creates required scenes, projection managers
48 // and GL viewers.
49
50 // Scenes
51 //========
52
53 fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry",
54 "Scene holding projected geometry for the RPhi view.");
55 fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry",
56 "Scene holding projected geometry for the RhoZ view.");
57 fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
58 "Scene holding projected event-data for the RPhi view.");
59 fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
60 "Scene holding projected event-data for the RhoZ view.");
61
62
63 // Projection managers
64 //=====================
65
67 gEve->AddToListTree(fRPhiMgr, kFALSE);
68 {
70 a->SetMainColor(kWhite);
71 a->SetTitle("R-Phi");
72 a->SetTitleSize(0.05);
73 a->SetTitleFont(102);
74 a->SetLabelSize(0.025);
75 a->SetLabelFont(102);
76 fRPhiGeomScene->AddElement(a);
77 }
78
80 gEve->AddToListTree(fRhoZMgr, kFALSE);
81 {
83 a->SetMainColor(kWhite);
84 a->SetTitle("Rho-Z");
85 a->SetTitleSize(0.05);
86 a->SetTitleFont(102);
87 a->SetLabelSize(0.025);
88 a->SetLabelFont(102);
89 fRhoZGeomScene->AddElement(a);
90 }
91
92
93 // Viewers
94 //=========
95
96 TEveWindowSlot *slot = nullptr;
97 TEveWindowPack *pack = nullptr;
98
100 pack = slot->MakePack();
101 pack->SetElementName("Multi View");
102 pack->SetHorizontal();
103 pack->SetShowTitleBar(kFALSE);
104 pack->NewSlot()->MakeCurrent();
105 f3DView = gEve->SpawnNewViewer("3D View", "");
106 f3DView->AddScene(gEve->GetGlobalScene());
107 f3DView->AddScene(gEve->GetEventScene());
108
109 pack = pack->NewSlot()->MakePack();
110 pack->SetShowTitleBar(kFALSE);
111 pack->NewSlot()->MakeCurrent();
112 fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
114 fRPhiView->AddScene(fRPhiGeomScene);
115 fRPhiView->AddScene(fRPhiEventScene);
116
117 pack->NewSlot()->MakeCurrent();
118 fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
120 fRhoZView->AddScene(fRhoZGeomScene);
121 fRhoZView->AddScene(fRhoZEventScene);
122 }
123
124 //---------------------------------------------------------------------------
125
126 void SetDepth(Float_t d)
127 {
128 // Set current depth on all projection managers.
129
130 fRPhiMgr->SetCurrentDepth(d);
131 fRhoZMgr->SetCurrentDepth(d);
132 }
133
134 //---------------------------------------------------------------------------
135
136 void ImportGeomRPhi(TEveElement* el)
137 {
138 fRPhiMgr->ImportElements(el, fRPhiGeomScene);
139 }
140
141 void ImportGeomRhoZ(TEveElement* el)
142 {
143 fRhoZMgr->ImportElements(el, fRhoZGeomScene);
144 }
145
146 void ImportEventRPhi(TEveElement* el)
147 {
148 fRPhiMgr->ImportElements(el, fRPhiEventScene);
149 }
150
151 void ImportEventRhoZ(TEveElement* el)
152 {
153 fRhoZMgr->ImportElements(el, fRhoZEventScene);
154 }
155
156 //---------------------------------------------------------------------------
157
158 void DestroyEventRPhi()
159 {
160 fRPhiEventScene->DestroyElements();
161 }
162
163 void DestroyEventRhoZ()
164 {
165 fRhoZEventScene->DestroyElements();
166 }
167};
168
#define d(i)
Definition RSha256.hxx:102
#define a(i)
Definition RSha256.hxx:99
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
@ kWhite
Definition Rtypes.h:65
R__EXTERN TEveManager * gEve
void SetElementName(const char *name) override
Virtual function for setting of name of an element.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual void DestroyElements()
Destroy all children of this element.
TEveScene * GetGlobalScene() const
TEveBrowser * GetBrowser() const
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=nullptr)
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
TEveScene * GetEventScene() const
Axes for non-linear projections.
Manager class for steering of projections and managing projected objects.
virtual TEveElement * ImportElements(TEveElement *el, TEveElement *ext_list=nullptr)
Recursively import elements and apply projection to the newly imported objects.
Eve representation of TGLScene.
Definition TEveScene.h:27
Eve representation of TGLViewer.
Definition TEveViewer.h:31
TGLViewer * GetGLViewer() const
Definition TEveViewer.h:51
virtual void AddScene(TEveScene *scene)
Add 'scene' to the list of scenes.
Encapsulates TGPack into an eve-window.
Definition TEveWindow.h:361
void SetHorizontal()
Definition TEveWindow.h:381
TEveWindowSlot * NewSlot() override
Create a new frame-slot at the last position of the pack.
Description of TEveWindowSlot.
Definition TEveWindow.h:302
TEveWindowPack * MakePack()
A pack is created in place of this window-slot.
void MakeCurrent()
Make this window current.
static TEveWindowSlot * CreateWindowInTab(TGTab *tab, TEveWindow *eve_parent=nullptr)
Create a new tab in a given tab-widget and populate it with a default window-slot.
void SetShowTitleBar(Bool_t x)
Set display state of the title-bar.
void SetCurrentCamera(ECameraType camera)
Set current active camera - 'cameraType' one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ,...
@ kCameraOrthoXOY
Definition TGLViewer.h:62
TGTab * GetTabRight() const