Extra header added to the list
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveMultiView.cxx
CommitLineData
1e9caa37 1// $Id$
2// Author: Matevz Tadel 2009
3
4/**************************************************************************
5 * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
9
10#include "AliEveMultiView.h"
11
12
13//______________________________________________________________________________
14// Full description of AliEveMultiView
15//
16
17ClassImp(AliEveMultiView)
18
19AliEveMultiView* AliEveMultiView::fgInstance = 0;
20
21AliEveMultiView* AliEveMultiView::Instance()
22{
23 // Return static instance.
24
25 return fgInstance;
26}
27
5f4e9982 28AliEveMultiView::AliEveMultiView(Bool_t setMuonView) :
29 fRPhiMgr(0), fRhoZMgr(0), fMuonMgr(0),
30 f3DView(0), fRPhiView(0), fRhoZView(0), fMuonView(0),
31 fRPhiGeomScene(0), fRhoZGeomScene(0), fMuonGeomScene(0),
32 fRPhiEventScene(0), fRhoZEventScene(0), fMuonEventScene(0),
1e9caa37 33 fGeomGentle(0), fGeomGentleRPhi(0), fGeomGentleRhoZ(0),
5f4e9982 34 fGeomGentleTrd(0), fGeomGentleMuon(0), fIsMuonView(kFALSE)
1e9caa37 35{
36 // Constructor --- creates required scenes, projection managers
37 // and GL viewers.
38
39 if (fgInstance)
40 throw TEveException("AliEveMultiView::AliEveMultiView already instantiated.");
41 fgInstance = this;
42
43 // Scenes
44 //========
45
46 fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry",
47 "Scene holding projected geometry for the RPhi view.");
48 fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry",
49 "Scene holding projected geometry for the RhoZ view.");
5f4e9982 50 fMuonGeomScene = gEve->SpawnNewScene("Muon Geometry",
51 "Scene holding projected geometry for the Muon view.");
1e9caa37 52 fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
53 "Scene holding projected event-data for the RPhi view.");
54 fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
55 "Scene holding projected event-data for the RhoZ view.");
5f4e9982 56 fMuonEventScene = gEve->SpawnNewScene("Muon Event Data",
57 "Scene holding projected event-data for the Muon view.");
1e9caa37 58
5f4e9982 59 fIsMuonView = setMuonView;
1e9caa37 60
61 // Projection managers
62 //=====================
63
64 fRPhiMgr = new TEveProjectionManager();
65 fRPhiMgr->SetProjection(TEveProjection::kPT_RPhi);
66 gEve->AddToListTree(fRPhiMgr, kFALSE);
67 {
68 TEveProjectionAxes* a = new TEveProjectionAxes(fRPhiMgr);
69 a->SetMainColor(kWhite);
70 a->SetTitle("R-Phi");
71 a->SetTitleSize(0.05);
72 a->SetTitleFont(102);
73 a->SetLabelSize(0.025);
74 a->SetLabelFont(102);
75 fRPhiGeomScene->AddElement(a);
76 }
77
78 fRhoZMgr = new TEveProjectionManager();
79 fRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ);
80 gEve->AddToListTree(fRhoZMgr, kFALSE);
81 {
82 TEveProjectionAxes* a = new TEveProjectionAxes(fRhoZMgr);
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
5f4e9982 92if(fIsMuonView)
93{
94 fMuonMgr = new TEveProjectionManager();
95 fMuonMgr->SetProjection(TEveProjection::kPT_RhoZ);
96 gEve->AddToListTree(fMuonMgr, kFALSE);
97 {
98 TEveProjectionAxes* a = new TEveProjectionAxes(fMuonMgr);
99 a->SetMainColor(kWhite);
100 a->SetTitle("Rho-Z Muon");
101 a->SetTitleSize(0.05);
102 a->SetTitleFont(102);
103 a->SetLabelSize(0.025);
104 a->SetLabelFont(102);
105 fMuonGeomScene->AddElement(a);
106 }
107}
1e9caa37 108
109 // Viewers
110 //=========
111
112 TEveWindowSlot *slot = 0;
113 TEveWindowPack *pack = 0;
114
115 slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
116 pack = slot->MakePack();
117 pack->SetElementName("Multi View");
118 pack->SetHorizontal();
119 pack->SetShowTitleBar(kFALSE);
120 pack->NewSlot()->MakeCurrent();
121 f3DView = gEve->SpawnNewViewer("3D View", "");
122 f3DView->AddScene(gEve->GetGlobalScene());
123 f3DView->AddScene(gEve->GetEventScene());
124
125 pack = pack->NewSlot()->MakePack();
126 pack->SetShowTitleBar(kFALSE);
127 pack->NewSlot()->MakeCurrent();
128 fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
129 fRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
130 fRPhiView->AddScene(fRPhiGeomScene);
131 fRPhiView->AddScene(fRPhiEventScene);
132
133 pack->NewSlot()->MakeCurrent();
134 fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
135 fRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
136 fRhoZView->AddScene(fRhoZGeomScene);
137 fRhoZView->AddScene(fRhoZEventScene);
5f4e9982 138
139if(fIsMuonView)
140{
141 pack->NewSlot()->MakeCurrent();
142 fMuonView = gEve->SpawnNewViewer("RhoZ View Muon", "");
143 fMuonView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
144 fMuonView->AddScene(fMuonGeomScene);
145 fMuonView->AddScene(fMuonEventScene);
146}
147
1e9caa37 148}
149
e10d437c 150AliEveMultiView::~AliEveMultiView()
151{
152 DestroyAllGeometries();
153
154 delete fGeomGentle;
155 delete fGeomGentleRPhi;
156 delete fGeomGentleRhoZ;
157
158 delete fRPhiMgr;
159 delete fRhoZMgr;
160 delete fMuonMgr;
161
162}
163
1e9caa37 164//-------------------------------------------------------------------------
165
5f4e9982 166void AliEveMultiView::InitGeomGentle(TEveGeoShape* g3d, TEveGeoShape* grphi, TEveGeoShape* grhoz, TEveGeoShape* gmuon)
1e9caa37 167{
168 // Initialize gentle geometry.
169
170 fGeomGentle = g3d;
171 fGeomGentleRPhi = grphi; fGeomGentleRPhi->IncDenyDestroy();
172 fGeomGentleRhoZ = grhoz; fGeomGentleRhoZ->IncDenyDestroy();
5f4e9982 173 if(fIsMuonView) { fGeomGentleMuon = gmuon; fGeomGentleMuon->IncDenyDestroy(); }
1e9caa37 174
175 ImportGeomRPhi(fGeomGentleRPhi);
176 ImportGeomRhoZ(fGeomGentleRhoZ);
5f4e9982 177 if(fIsMuonView) ImportGeomMuon(fGeomGentleMuon);
1e9caa37 178}
179
180void AliEveMultiView::InitGeomGentleTrd(TEveGeoShape* gtrd)
181{
182 // Initialize gentle geometry TRD.
183
184 fGeomGentleTrd = gtrd;
185 ImportGeomRPhi(fGeomGentleTrd);
186 ImportGeomRhoZ(fGeomGentleTrd);
5f4e9982 187 if(fIsMuonView) ImportGeomMuon(fGeomGentleTrd);
1e9caa37 188}
189
5f4e9982 190void AliEveMultiView::InitGeomGentleMuon(TEveGeoShape* gmuon, Bool_t showRPhi, Bool_t showRhoZ, Bool_t showMuon)
1e9caa37 191{
192 // Initialize gentle geometry for MUON.
193
194 fGeomGentleMuon = gmuon;
195 if (showRPhi) ImportGeomRPhi(fGeomGentleMuon);
196 if (showRhoZ) ImportGeomRhoZ(fGeomGentleMuon);
5f4e9982 197 if (showMuon && fIsMuonView) ImportGeomMuon(fGeomGentleMuon);
198
1e9caa37 199}
200
201//-------------------------------------------------------------------------
202
203void AliEveMultiView::SetDepth(Float_t d)
204{
205 // Set current depth on all projection managers.
206
207 fRPhiMgr->SetCurrentDepth(d);
208 fRhoZMgr->SetCurrentDepth(d);
5f4e9982 209 if(fIsMuonView) fMuonMgr->SetCurrentDepth(d);
210
1e9caa37 211}
212
213//-------------------------------------------------------------------------
214
215void AliEveMultiView::ImportGeomRPhi(TEveElement* el)
216{
217 // Import el into r-phi geometry scene.
218
219 fRPhiMgr->ImportElements(el, fRPhiGeomScene);
220}
221
222void AliEveMultiView::ImportGeomRhoZ(TEveElement* el)
223{
224 // Import el into rho-z geometry scene.
225
226 fRhoZMgr->ImportElements(el, fRhoZGeomScene);
227}
228
5f4e9982 229void AliEveMultiView::ImportGeomMuon(TEveElement* el)
230{
231 // Import el into muon geometry scene.
232
233 if(fIsMuonView) fMuonMgr->ImportElements(el, fMuonGeomScene);
234}
235
1e9caa37 236void AliEveMultiView::ImportEventRPhi(TEveElement* el)
237{
238 // Import el into r-phi event scene.
239
240 fRPhiMgr->ImportElements(el, fRPhiEventScene);
241}
242
243void AliEveMultiView::ImportEventRhoZ(TEveElement* el)
244{
245 // Import el into rho-z event scene.
246
247 fRhoZMgr->ImportElements(el, fRhoZEventScene);
248}
249
5f4e9982 250void AliEveMultiView::ImportEventMuon(TEveElement* el)
251{
252 // Import el into muon event scene.
253
254 if(fIsMuonView) fMuonMgr->ImportElements(el, fMuonEventScene);
255}
256
1e9caa37 257void AliEveMultiView::DestroyEventRPhi()
258{
259 // Destroy all elements in r-phi event scene.
260
261 fRPhiEventScene->DestroyElements();
262}
263
264void AliEveMultiView::DestroyEventRhoZ()
265{
266 // Destroy all elements in rho-z event scene.
267
268 fRhoZEventScene->DestroyElements();
269}
270
5f4e9982 271void AliEveMultiView::DestroyEventMuon()
272{
273 // Destroy all elements in rho-z event scene.
274
275 if(fIsMuonView) fMuonEventScene->DestroyElements();
276}
277
278
1e9caa37 279//-------------------------------------------------------------------------
280
281void AliEveMultiView::SetCenterRPhi(Double_t x, Double_t y, Double_t z)
282{
283 // Set center of r-phi manager.
284
285 fRPhiMgr->SetCenter(x, y, z);
286}
287
288void AliEveMultiView::SetCenterRhoZ(Double_t x, Double_t y, Double_t z)
289{
290 // Set center of rho-z manager.
291
292 fRhoZMgr->SetCenter(x, y, z);
293}
294
5f4e9982 295void AliEveMultiView::SetCenterMuon(Double_t x, Double_t y, Double_t z)
296{
297 // Set center of rho-z manager.
298
299 if(fIsMuonView) fMuonMgr->SetCenter(x, y, z);
300}
301
a13d7c88 302void AliEveMultiView::DestroyAllGeometries()
303{
304 // Destroy 3d, r-phi and rho-z geometries.
305
306 fGeomGentle->DestroyElements();
307 fGeomGentleRPhi->DestroyElements();
308 fGeomGentleRhoZ->DestroyElements();
5f4e9982 309 if(fIsMuonView) fGeomGentleMuon->DestroyElements();
a13d7c88 310
311}
312