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