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 {
33
37
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
63 {
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
76 {
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
94 pack = slot->MakePack();
95 pack->SetElementName("Multi View");
96 pack->SetHorizontal();
97 pack->SetShowTitleBar(kFALSE);
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", "");
107 fRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
108 fRPhiView->AddScene(fRPhiGeomScene);
109 fRPhiView->AddScene(fRPhiEventScene);
110
111 pack->NewSlot()->MakeCurrent();
112 fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
113 fRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
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
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
@ kWhite
Definition Rtypes.h:65
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TEveManager * gEve
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
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.
Eve representation of TGLScene.
Definition TEveScene.h:27
Eve representation of TGLViewer.
Definition TEveViewer.h:31
Encapsulates TGPack into an eve-window.
Definition TEveWindow.h:361
Description of TEveWindowSlot.
Definition TEveWindow.h:302
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.
@ kCameraOrthoXOY
Definition TGLViewer.h:62
TGTab * GetTabRight() const