]>
Commit | Line | Data |
---|---|---|
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 | ||
17 | ClassImp(AliEveMultiView) | |
18 | ||
19 | AliEveMultiView* AliEveMultiView::fgInstance = 0; | |
20 | ||
21 | AliEveMultiView* AliEveMultiView::Instance() | |
22 | { | |
23 | // Return static instance. | |
24 | ||
25 | return fgInstance; | |
26 | } | |
27 | ||
28 | AliEveMultiView::AliEveMultiView() : | |
402f6da7 | 29 | fRPhiMgr(0), fRhoZMgr(0), |
30 | f3DView(0), fRPhiView(0), fRhoZView(0), | |
31 | fRPhiGeomScene(0), fRhoZGeomScene(0), fRPhiEventScene(0), fRhoZEventScene(0), | |
1e9caa37 | 32 | fGeomGentle(0), fGeomGentleRPhi(0), fGeomGentleRhoZ(0), |
33 | fGeomGentleTrd(0), fGeomGentleMuon(0) | |
34 | { | |
35 | // Constructor --- creates required scenes, projection managers | |
36 | // and GL viewers. | |
37 | ||
38 | if (fgInstance) | |
39 | throw TEveException("AliEveMultiView::AliEveMultiView already instantiated."); | |
40 | fgInstance = this; | |
41 | ||
42 | // Scenes | |
43 | //======== | |
44 | ||
45 | fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry", | |
46 | "Scene holding projected geometry for the RPhi view."); | |
47 | fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry", | |
48 | "Scene holding projected geometry for the RhoZ view."); | |
49 | fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data", | |
50 | "Scene holding projected event-data for the RPhi view."); | |
51 | fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data", | |
52 | "Scene holding projected event-data for the RhoZ view."); | |
53 | ||
54 | ||
55 | // Projection managers | |
56 | //===================== | |
57 | ||
58 | fRPhiMgr = new TEveProjectionManager(); | |
59 | fRPhiMgr->SetProjection(TEveProjection::kPT_RPhi); | |
60 | gEve->AddToListTree(fRPhiMgr, kFALSE); | |
61 | { | |
62 | TEveProjectionAxes* a = new TEveProjectionAxes(fRPhiMgr); | |
63 | a->SetMainColor(kWhite); | |
64 | a->SetTitle("R-Phi"); | |
65 | a->SetTitleSize(0.05); | |
66 | a->SetTitleFont(102); | |
67 | a->SetLabelSize(0.025); | |
68 | a->SetLabelFont(102); | |
69 | fRPhiGeomScene->AddElement(a); | |
70 | } | |
71 | ||
72 | fRhoZMgr = new TEveProjectionManager(); | |
73 | fRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ); | |
74 | gEve->AddToListTree(fRhoZMgr, kFALSE); | |
75 | { | |
76 | TEveProjectionAxes* a = new TEveProjectionAxes(fRhoZMgr); | |
77 | a->SetMainColor(kWhite); | |
78 | a->SetTitle("Rho-Z"); | |
79 | a->SetTitleSize(0.05); | |
80 | a->SetTitleFont(102); | |
81 | a->SetLabelSize(0.025); | |
82 | a->SetLabelFont(102); | |
83 | fRhoZGeomScene->AddElement(a); | |
84 | } | |
85 | ||
86 | ||
87 | // Viewers | |
88 | //========= | |
89 | ||
90 | TEveWindowSlot *slot = 0; | |
91 | TEveWindowPack *pack = 0; | |
92 | ||
93 | slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight()); | |
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 AliEveMultiView::InitGeomGentle(TEveGeoShape* g3d, TEveGeoShape* grphi, TEveGeoShape* grhoz) | |
121 | { | |
122 | // Initialize gentle geometry. | |
123 | ||
124 | fGeomGentle = g3d; | |
125 | fGeomGentleRPhi = grphi; fGeomGentleRPhi->IncDenyDestroy(); | |
126 | fGeomGentleRhoZ = grhoz; fGeomGentleRhoZ->IncDenyDestroy(); | |
127 | ||
128 | ImportGeomRPhi(fGeomGentleRPhi); | |
129 | ImportGeomRhoZ(fGeomGentleRhoZ); | |
130 | } | |
131 | ||
132 | void AliEveMultiView::InitGeomGentleTrd(TEveGeoShape* gtrd) | |
133 | { | |
134 | // Initialize gentle geometry TRD. | |
135 | ||
136 | fGeomGentleTrd = gtrd; | |
137 | ImportGeomRPhi(fGeomGentleTrd); | |
138 | ImportGeomRhoZ(fGeomGentleTrd); | |
139 | } | |
140 | ||
141 | void AliEveMultiView::InitGeomGentleMuon(TEveGeoShape* gmuon, Bool_t showRPhi, Bool_t showRhoZ) | |
142 | { | |
143 | // Initialize gentle geometry for MUON. | |
144 | ||
145 | fGeomGentleMuon = gmuon; | |
146 | if (showRPhi) ImportGeomRPhi(fGeomGentleMuon); | |
147 | if (showRhoZ) ImportGeomRhoZ(fGeomGentleMuon); | |
148 | } | |
149 | ||
150 | //------------------------------------------------------------------------- | |
151 | ||
152 | void AliEveMultiView::SetDepth(Float_t d) | |
153 | { | |
154 | // Set current depth on all projection managers. | |
155 | ||
156 | fRPhiMgr->SetCurrentDepth(d); | |
157 | fRhoZMgr->SetCurrentDepth(d); | |
158 | } | |
159 | ||
160 | //------------------------------------------------------------------------- | |
161 | ||
162 | void AliEveMultiView::ImportGeomRPhi(TEveElement* el) | |
163 | { | |
164 | // Import el into r-phi geometry scene. | |
165 | ||
166 | fRPhiMgr->ImportElements(el, fRPhiGeomScene); | |
167 | } | |
168 | ||
169 | void AliEveMultiView::ImportGeomRhoZ(TEveElement* el) | |
170 | { | |
171 | // Import el into rho-z geometry scene. | |
172 | ||
173 | fRhoZMgr->ImportElements(el, fRhoZGeomScene); | |
174 | } | |
175 | ||
176 | void AliEveMultiView::ImportEventRPhi(TEveElement* el) | |
177 | { | |
178 | // Import el into r-phi event scene. | |
179 | ||
180 | fRPhiMgr->ImportElements(el, fRPhiEventScene); | |
181 | } | |
182 | ||
183 | void AliEveMultiView::ImportEventRhoZ(TEveElement* el) | |
184 | { | |
185 | // Import el into rho-z event scene. | |
186 | ||
187 | fRhoZMgr->ImportElements(el, fRhoZEventScene); | |
188 | } | |
189 | ||
190 | void AliEveMultiView::DestroyEventRPhi() | |
191 | { | |
192 | // Destroy all elements in r-phi event scene. | |
193 | ||
194 | fRPhiEventScene->DestroyElements(); | |
195 | } | |
196 | ||
197 | void AliEveMultiView::DestroyEventRhoZ() | |
198 | { | |
199 | // Destroy all elements in rho-z event scene. | |
200 | ||
201 | fRhoZEventScene->DestroyElements(); | |
202 | } | |
203 | ||
204 | //------------------------------------------------------------------------- | |
205 | ||
206 | void AliEveMultiView::SetCenterRPhi(Double_t x, Double_t y, Double_t z) | |
207 | { | |
208 | // Set center of r-phi manager. | |
209 | ||
210 | fRPhiMgr->SetCenter(x, y, z); | |
211 | } | |
212 | ||
213 | void AliEveMultiView::SetCenterRhoZ(Double_t x, Double_t y, Double_t z) | |
214 | { | |
215 | // Set center of rho-z manager. | |
216 | ||
217 | fRhoZMgr->SetCenter(x, y, z); | |
218 | } | |
219 |