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