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", "Scene holding projected geometry for the RPhi view.");
54 fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry", "Scene holding projected geometry for the RhoZ view.");
55 fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data", "Scene holding projected event-data for the RPhi view.");
56 fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data", "Scene holding projected event-data for the RhoZ view.");
57
58 // Projection managers
59 //=====================
60
61 fRPhiMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
62 gEve->AddToListTree(fRPhiMgr, kFALSE);
63 {
64 TEveProjectionAxes *a = new TEveProjectionAxes(fRPhiMgr);
65 a->SetMainColor(kWhite);
66 a->SetTitle("R-Phi");
67 a->SetTitleSize(0.05);
68 a->SetTitleFont(102);
69 a->SetLabelSize(0.025);
70 a->SetLabelFont(102);
71 fRPhiGeomScene->AddElement(a);
72 }
73
74 fRhoZMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
75 gEve->AddToListTree(fRhoZMgr, kFALSE);
76 {
77 TEveProjectionAxes *a = new TEveProjectionAxes(fRhoZMgr);
78 a->SetMainColor(kWhite);
79 a->SetTitle("Rho-Z");
80 a->SetTitleSize(0.05);
81 a->SetTitleFont(102);
82 a->SetLabelSize(0.025);
83 a->SetLabelFont(102);
84 fRhoZGeomScene->AddElement(a);
85 }
86
87 // Viewers
88 //=========
89
90 TEveWindowSlot *slot = nullptr;
91 TEveWindowPack *pack = nullptr;
92
93 slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
94 pack = slot->MakePack();
95 pack->SetElementName("Multi View");
96 pack->SetHorizontal();
98 pack->NewSlot()->MakeCurrent();
99 f3DView = gEve->SpawnNewViewer("3D View", "");
100 f3DView->AddScene(gEve->GetGlobalScene());
101 f3DView->AddScene(gEve->GetEventScene());
102
103 pack = pack->NewSlot()->MakePack();
104 pack->SetShowTitleBar(kFALSE);
105 pack->NewSlot()->MakeCurrent();
106 fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
108 fRPhiView->AddScene(fRPhiGeomScene);
109 fRPhiView->AddScene(fRPhiEventScene);
110
111 pack->NewSlot()->MakeCurrent();
112 fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
114 fRhoZView->AddScene(fRhoZGeomScene);
115 fRhoZView->AddScene(fRhoZEventScene);
116 }
117
118 //---------------------------------------------------------------------------
119
120 void SetDepth(Float_t d)
121 {
122 // Set current depth on all projection managers.
123
124 fRPhiMgr->SetCurrentDepth(d);
125 fRhoZMgr->SetCurrentDepth(d);
126 }
127
128 //---------------------------------------------------------------------------
129
130 void ImportGeomRPhi(TEveElement *el) { fRPhiMgr->ImportElements(el, fRPhiGeomScene); }
131
132 void ImportGeomRhoZ(TEveElement *el) { fRhoZMgr->ImportElements(el, fRhoZGeomScene); }
133
134 void ImportEventRPhi(TEveElement *el) { fRPhiMgr->ImportElements(el, fRPhiEventScene); }
135
136 void ImportEventRhoZ(TEveElement *el) { fRhoZMgr->ImportElements(el, fRhoZEventScene); }
137
138 //---------------------------------------------------------------------------
139
140 void DestroyEventRPhi() { fRPhiEventScene->DestroyElements(); }
141
142 void DestroyEventRhoZ() { fRhoZEventScene->DestroyElements(); }
143};
#define d(i)
Definition RSha256.hxx:102
#define a(i)
Definition RSha256.hxx:99
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
@ kWhite
Definition Rtypes.h:66
externTEveManager * gEve
void SetElementName(const char *name) override
Virtual function for setting of name of an element.
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual void DestroyElements()
Destroy all children of this element.
virtual TEveElement * ImportElements(TEveElement *el, TEveElement *ext_list=nullptr)
Recursively import elements and apply projection to the newly imported objects.
TGLViewer * GetGLViewer() const
Definition TEveViewer.h:51
virtual void AddScene(TEveScene *scene)
Add 'scene' to the list of scenes.
void SetHorizontal()
Definition TEveWindow.h:381
TEveWindowSlot * NewSlot() override
Create a new frame-slot at the last position of the pack.
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