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