20dae051 |
1 | // $Id$ |
e9b9f7d2 |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 |
3 | |
4 | /************************************************************************** |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * |
7 | * full copyright notice. * |
8 | **************************************************************************/ |
9 | |
20dae051 |
10 | class AliEveMacroExecutor; |
11 | |
e9b9f7d2 |
12 | class TEveProjectionManager; |
13 | class TEveGeoShape; |
14 | class TEveUtil; |
15 | |
5e078eda |
16 | TEveGeoShape *gGeomGentle = 0; |
17 | TEveGeoShape *gGeomGentleRPhi = 0; |
18 | TEveGeoShape *gGeomGentleRhoZ = 0; |
19 | TEveGeoShape *gGeomGentleTRD = 0; |
20dae051 |
20 | TEveGeoShape *gGeomGentleMUON = 0; |
21 | |
22 | TEveScene *gRPhiGeomScene = 0; |
23 | TEveScene *gRhoZGeomScene = 0; |
24 | TEveScene *gRPhiEventScene = 0; |
25 | TEveScene *gRhoZEventScene = 0; |
26 | |
27 | TEveProjectionManager *gRPhiMgr = 0; |
28 | TEveProjectionManager *gRhoZMgr = 0; |
29 | |
30 | TEveViewer *g3DView = 0; |
31 | TEveViewer *gRPhiView = 0; |
32 | TEveViewer *gRhoZView = 0; |
503bfbc8 |
33 | |
20dae051 |
34 | Bool_t gShowTRD = kFALSE; |
35 | Bool_t gShowMUON = kTRUE; |
36 | Bool_t gShowMUONRPhi = kFALSE; |
115b6655 |
37 | Bool_t gShowMUONRhoZ = kTRUE; |
20dae051 |
38 | |
39 | Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE; |
e9b9f7d2 |
40 | |
c63f2997 |
41 | |
42 | void visscan_init(const TString& cdburi = "", |
43 | const TString& path = ".", Bool_t show_extra_geo = kFALSE) |
e9b9f7d2 |
44 | { |
c63f2997 |
45 | if (cdburi.IsNull() && ! AliCDBManager::Instance()->IsDefaultStorageSet()) |
46 | { |
47 | gEnv->SetValue("Root.Stacktrace", "no"); |
48 | Fatal("visscan_init.C", "OCDB path MUST be specified as the first argument."); |
49 | } |
50 | |
115b6655 |
51 | if (!show_extra_geo) |
52 | { |
53 | gShowTRD = gShowMUON = gShowMUONRPhi = gShowMUONRhoZ = kFALSE; |
54 | } |
55 | |
f8d5a389 |
56 | AliEveEventManager::AddAODfriend("AliAOD.VertexingHF.root"); |
57 | |
e9b9f7d2 |
58 | TEveUtil::LoadMacro("alieve_init.C"); |
c63f2997 |
59 | alieve_init(cdburi, path, -1); |
e9b9f7d2 |
60 | |
20dae051 |
61 | // TEveLine::SetDefaultSmooth(1); |
e9b9f7d2 |
62 | |
20dae051 |
63 | TEveUtil::AssertMacro("VizDB_scan.C"); |
64 | |
65 | AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor(); |
66 | TEveBrowser *browser = gEve->GetBrowser(); |
67 | |
68 | //============================================================================== |
69 | // Geometry, scenes, projections and viewers |
70 | //============================================================================== |
71 | |
72 | browser->ShowCloseTab(kFALSE); |
e9b9f7d2 |
73 | |
68ca2fe7 |
74 | // Geometry |
20dae051 |
75 | |
f6afd0e1 |
76 | TEveUtil::LoadMacro("geom_gentle.C"); |
20dae051 |
77 | gGeomGentle = geom_gentle(); |
5e078eda |
78 | gGeomGentleRPhi = geom_gentle_rphi(); gGeomGentleRPhi->IncDenyDestroy(); |
79 | gGeomGentleRhoZ = geom_gentle_rhoz(); gGeomGentleRhoZ->IncDenyDestroy(); |
f6afd0e1 |
80 | if (gShowTRD) { |
81 | TEveUtil::LoadMacro("geom_gentle_trd.C"); |
82 | gGeomGentleTRD = geom_gentle_trd(); |
83 | } |
20dae051 |
84 | if (gShowMUON) { |
85 | TEveUtil::LoadMacro("geom_gentle_muon.C"); |
ae8fef5f |
86 | gGeomGentleMUON = geom_gentle_muon(kFALSE); |
20dae051 |
87 | } |
f6afd0e1 |
88 | |
20dae051 |
89 | // Scenes |
68ca2fe7 |
90 | |
20dae051 |
91 | gRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry", |
92 | "Scene holding projected geometry for the RPhi view."); |
93 | gRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry", |
94 | "Scene holding projected geometry for the RhoZ view."); |
95 | gRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data", |
96 | "Scene holding projected geometry for the RPhi view."); |
97 | gRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data", |
98 | "Scene holding projected geometry for the RhoZ view."); |
f6afd0e1 |
99 | |
20dae051 |
100 | // Projection managers |
f6afd0e1 |
101 | |
20dae051 |
102 | gRPhiMgr = new TEveProjectionManager(); |
103 | gRPhiMgr->SetProjection(TEveProjection::kPT_RPhi); |
104 | gEve->AddToListTree(gRPhiMgr, kFALSE); |
105 | { |
68ca2fe7 |
106 | TEveProjectionAxes* a = new TEveProjectionAxes(gRPhiMgr); |
107 | a->SetMainColor(kWhite); |
108 | a->SetTitle("R-Phi"); |
109 | a->SetTitleSize(0.05); |
115b6655 |
110 | a->SetTitleFont(102); |
68ca2fe7 |
111 | a->SetLabelSize(0.025); |
115b6655 |
112 | a->SetLabelFont(102); |
20dae051 |
113 | gRPhiGeomScene->AddElement(a); |
68ca2fe7 |
114 | } |
9851a663 |
115 | gRPhiMgr->SetCurrentDepth(-10); |
20dae051 |
116 | gRPhiMgr->ImportElements(gGeomGentleRPhi, gRPhiGeomScene); |
9851a663 |
117 | gRPhiMgr->SetCurrentDepth(0); |
20dae051 |
118 | if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD, gRPhiGeomScene); |
119 | if (gShowMUONRPhi) gRPhiMgr->ImportElements(gGeomGentleMUON, gRPhiGeomScene); |
120 | |
121 | gRhoZMgr = new TEveProjectionManager(); |
122 | gRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ); |
123 | gEve->AddToListTree(gRhoZMgr, kFALSE); |
124 | { |
68ca2fe7 |
125 | TEveProjectionAxes* a = new TEveProjectionAxes(gRhoZMgr); |
126 | a->SetMainColor(kWhite); |
127 | a->SetTitle("Rho-Z"); |
128 | a->SetTitleSize(0.05); |
115b6655 |
129 | a->SetTitleFont(102); |
68ca2fe7 |
130 | a->SetLabelSize(0.025); |
115b6655 |
131 | a->SetLabelFont(102); |
20dae051 |
132 | gRhoZGeomScene->AddElement(a); |
68ca2fe7 |
133 | } |
9851a663 |
134 | gRhoZMgr->SetCurrentDepth(-10); |
20dae051 |
135 | gRhoZMgr->ImportElements(gGeomGentleRhoZ, gRhoZGeomScene); |
9851a663 |
136 | gRhoZMgr->SetCurrentDepth(0); |
20dae051 |
137 | if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD, gRhoZGeomScene); |
138 | if (gShowMUONRhoZ) gRhoZMgr->ImportElements(gGeomGentleMUON, gRhoZGeomScene); |
139 | |
140 | // Viewers |
141 | |
142 | TEveWindowSlot *slot = 0; |
143 | TEveWindowPack *pack = 0; |
144 | |
145 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); |
146 | pack = slot->MakePack(); |
147 | pack->SetElementName("Multi View"); |
148 | pack->SetHorizontal(); |
149 | pack->SetShowTitleBar(kFALSE); |
150 | pack->NewSlot()->MakeCurrent(); |
151 | g3DView = gEve->SpawnNewViewer("3D View", ""); |
152 | g3DView->AddScene(gEve->GetGlobalScene()); |
153 | g3DView->AddScene(gEve->GetEventScene()); |
154 | |
155 | pack = pack->NewSlot()->MakePack(); |
156 | pack->SetShowTitleBar(kFALSE); |
157 | pack->NewSlot()->MakeCurrent(); |
158 | gRPhiView = gEve->SpawnNewViewer("RPhi View", ""); |
159 | gRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); |
160 | gRPhiView->AddScene(gRPhiGeomScene); |
161 | gRPhiView->AddScene(gRPhiEventScene); |
162 | |
163 | pack->NewSlot()->MakeCurrent(); |
164 | gRhoZView = gEve->SpawnNewViewer("RhoZ View", ""); |
165 | gRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); |
166 | gRhoZView->AddScene(gRhoZGeomScene); |
167 | gRhoZView->AddScene(gRhoZEventScene); |
168 | |
169 | |
170 | //============================================================================== |
171 | // Registration of per-event macros |
172 | //============================================================================== |
173 | |
174 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C", "kine_tracks", "", kFALSE)); |
175 | |
176 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit ITS", "its_hits.C", "its_hits", "", kFALSE)); |
177 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit TPC", "tpc_hits.C", "tpc_hits", "", kFALSE)); |
178 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0", "t0_hits.C", "t0_hits", "", kFALSE)); |
179 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit FMD", "fmd_hits.C", "fmd_hits", "", kFALSE)); |
180 | |
1eda7a67 |
181 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG ITS", "its_digits.C", "its_digits", "", kFALSE)); |
20dae051 |
182 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD", "fmd_digits.C", "fmd_digits", "", kFALSE)); |
183 | |
1eda7a67 |
184 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS", "its_raw.C", "its_raw", "", kFALSE)); |
20dae051 |
185 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE)); |
186 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE)); |
187 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE)); |
188 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE)); |
189 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE)); |
190 | |
191 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE)); |
192 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE)); |
193 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE)); |
194 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE)); |
195 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE)); |
196 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE)); |
197 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE)); |
198 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE)); |
199 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE)); |
200 | |
201 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_onfly")); |
202 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_offline")); |
203 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0.C", "esd_V0")); |
204 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C", "esd_cascade_points")); |
205 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade")); |
4711ad43 |
206 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink_points.C", "esd_kink_points")); |
207 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink.C", "esd_kink")); |
20dae051 |
208 | |
209 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE)); |
210 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE)); |
211 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE)); |
212 | |
213 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE)); |
214 | |
215 | exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC", "esd_zdc.C", "esd_zdc", "", kFALSE)); |
216 | |
217 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus", "clusters.C+", "clusters", "", kFALSE)); |
218 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C+", "its_clusters")); |
219 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C+", "tpc_clusters")); |
220 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters")); |
221 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters")); |
222 | |
08b0f222 |
223 | exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "vplot_tpc.C+", "vplot_tpc", "", kFALSE)); |
224 | |
f8d5a389 |
225 | exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA HF", "aod_HF.C", "aod_HF", "", kFALSE)); |
08b0f222 |
226 | exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE)); |
20dae051 |
227 | |
228 | //============================================================================== |
229 | // Additional GUI components |
230 | //============================================================================== |
231 | |
232 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); |
233 | slot->StartEmbedding(); |
234 | AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec); |
235 | slot->StopEmbedding("DataSelection"); |
236 | exewin->PopulateMacros(); |
237 | |
238 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); |
239 | slot->StartEmbedding(); |
240 | new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE); |
241 | slot->StopEmbedding("QA histograms"); |
242 | |
008ac94c |
243 | //event selection tab |
244 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); |
245 | slot->StartEmbedding(); |
246 | new AliEveEventSelectorWindow(gClient->GetRoot(), 600, 400, AliEveEventManager::GetMaster()->GetEventSelector()); |
247 | slot->StopEmbedding("Selections"); |
248 | |
20dae051 |
249 | browser->GetTabRight()->SetTab(1); |
250 | |
251 | browser->StartEmbedding(TRootBrowser::kBottom); |
252 | new AliEveEventManagerWindow(AliEveEventManager::GetMaster()); |
253 | browser->StopEmbedding("EventCtrl"); |
254 | |
255 | slot = TEveWindow::CreateWindowInTab(browser->GetTabRight()); |
256 | TEveWindowTab *store_tab = slot->MakeTab(); |
257 | store_tab->SetElementNameTitle("WindowStore", |
258 | "Undocked windows whose previous container is not known\n" |
259 | "are placed here when the main-frame is closed."); |
260 | gEve->GetWindowManager()->SetDefaultContainer(store_tab); |
68ca2fe7 |
261 | |
20dae051 |
262 | //============================================================================== |
263 | // AliEve objects - global tools |
264 | //============================================================================== |
265 | |
266 | AliEveTrackFitter* fitter = new AliEveTrackFitter(); |
267 | gEve->AddToListTree(fitter, 1); |
268 | gEve->AddElement(fitter, gEve->GetEventScene()); |
269 | |
270 | AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter"); |
271 | gEve->AddToListTree(g_trkcnt, kFALSE); |
272 | |
273 | |
274 | //============================================================================== |
275 | // Final stuff |
276 | //============================================================================== |
277 | |
278 | // A refresh to show proper window. |
279 | gEve->Redraw3D(kTRUE); |
280 | gSystem->ProcessEvents(); |
281 | |
282 | // Register command to call on each event. |
4d62585e |
283 | AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();"); |
284 | AliEveEventManager::GetMaster()->GotoEvent(0); |
e9b9f7d2 |
285 | |
ca49b003 |
286 | gEve->EditElement(g_trkcnt); |
287 | |
e9b9f7d2 |
288 | gEve->Redraw3D(kTRUE); |
289 | } |
290 | |
291 | /******************************************************************************/ |
292 | |
293 | void on_new_event() |
294 | { |
f76c9e9b |
295 | AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance; |
e9b9f7d2 |
296 | g_trkcnt->Reset(); |
4d62585e |
297 | g_trkcnt->SetEventId(AliEveEventManager::GetMaster()->GetEventId()); |
29207369 |
298 | |
20dae051 |
299 | if (g_esd_tracks_by_category_container != 0) |
df56539f |
300 | { |
20dae051 |
301 | TEveElementList* cont = g_esd_tracks_by_category_container; |
302 | |
303 | // Here we expect several TEveTrackList containers. |
304 | // First two have reasonable primaries (sigma-to-prim-vertex < 5). |
305 | // Others are almost certainly secondaries. |
306 | Int_t count = 1; |
307 | TEveElement::List_i i = cont->BeginChildren(); |
308 | while (i != cont->EndChildren()) |
29207369 |
309 | { |
20dae051 |
310 | TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i); |
311 | if (l != 0) |
312 | { |
313 | g_trkcnt->RegisterTracks(l, (count <= 2)); |
314 | ++count; |
315 | } |
316 | ++i; |
e9b9f7d2 |
317 | } |
20dae051 |
318 | |
319 | // Set it to zero, so that we do not reuse an old one. |
320 | g_esd_tracks_by_category_container = 0; |
321 | } |
322 | else |
323 | { |
324 | Warning("on_new_event", "g_esd_tracks_by_category_container not initialized."); |
e9b9f7d2 |
325 | } |
326 | |
20dae051 |
327 | Double_t x[3] = { 0, 0, 0 }; |
328 | |
329 | if (AliEveEventManager::HasESD()) |
a27140cb |
330 | { |
20dae051 |
331 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
332 | esd->GetPrimaryVertex()->GetXYZ(x); |
333 | |
a27140cb |
334 | TTimeStamp ts(esd->GetTimeStamp()); |
335 | TString win_title("Eve Main Window -- Timestamp: "); |
336 | win_title += ts.AsString("s"); |
5858bcbe |
337 | win_title += "; Event # in ESD file: "; |
a27140cb |
338 | win_title += esd->GetEventNumberInFile(); |
339 | gEve->GetBrowser()->SetWindowName(win_title); |
340 | } |
e9b9f7d2 |
341 | |
342 | TEveElement* top = gEve->GetCurrentEvent(); |
343 | |
20dae051 |
344 | if (gRPhiMgr && top) |
345 | { |
346 | gRPhiEventScene->DestroyElements(); |
347 | if (gCenterProjectionsAtPrimaryVertex) |
348 | gRPhiMgr->SetCenter(x[0], x[1], x[2]); |
349 | gRPhiMgr->ImportElements(top, gRPhiEventScene); |
e9b9f7d2 |
350 | } |
20dae051 |
351 | if (gRhoZMgr && top) |
352 | { |
353 | gRhoZEventScene->DestroyElements(); |
354 | if (gCenterProjectionsAtPrimaryVertex) |
355 | gRhoZMgr->SetCenter(x[0], x[1], x[2]); |
356 | gRhoZMgr->ImportElements(top, gRhoZEventScene); |
e9b9f7d2 |
357 | } |
e9b9f7d2 |
358 | } |