* EVE/macros/alieve_online.C
[u/mrichter/AliRoot.git] / EVE / macros / anyscan_init.C
CommitLineData
20dae051 1// $Id$
f6afd0e1 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// This macro has been cloned to visscan_init.C
11// This one will be removed soon and will not be updated any further.
12
f6afd0e1 13class AliEveMacroExecutor;
14
15class TEveProjectionManager;
16class TEveGeoShape;
17class TEveUtil;
18
ad5abc55 19TEveGeoShape *gGeomGentle = 0;
20TEveGeoShape *gGeomGentleRPhi = 0;
21TEveGeoShape *gGeomGentleRhoZ = 0;
22TEveGeoShape *gGeomGentleTRD = 0;
20dae051 23TEveGeoShape *gGeomGentleMUON = 0;
f6afd0e1 24
68ca2fe7 25TEveScene *gRPhiGeomScene = 0;
26TEveScene *gRhoZGeomScene = 0;
27TEveScene *gRPhiEventScene = 0;
28TEveScene *gRhoZEventScene = 0;
29
30TEveProjectionManager *gRPhiMgr = 0;
31TEveProjectionManager *gRhoZMgr = 0;
32
33TEveViewer *g3DView = 0;
34TEveViewer *gRPhiView = 0;
35TEveViewer *gRhoZView = 0;
36
20dae051 37Bool_t gShowTRD = kFALSE;
38Bool_t gShowMUON = kTRUE;
39Bool_t gShowMUONRPhi = kFALSE;
40Bool_t gShowMUONRhoZ = kFALSE;
f6afd0e1 41
68ca2fe7 42Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
43
f6afd0e1 44void anyscan_init()
45{
0e33c639 46 Warning("anyscan_init", "This macro is deprecated - use visscan_init instead.");
47
f6afd0e1 48 TEveUtil::LoadMacro("alieve_init.C");
49 alieve_init(".", -1);
50
df56539f 51 // TEveLine::SetDefaultSmooth(1);
f6afd0e1 52
53 TEveUtil::AssertMacro("VizDB_scan.C");
54
68ca2fe7 55 AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor();
56 TEveBrowser *browser = gEve->GetBrowser();
f6afd0e1 57
68ca2fe7 58 //==============================================================================
59 // Geometry, scenes, projections and viewers
60 //==============================================================================
f6afd0e1 61
68ca2fe7 62 browser->ShowCloseTab(kFALSE);
f6afd0e1 63
68ca2fe7 64 // Geometry
f6afd0e1 65
f6afd0e1 66 TEveUtil::LoadMacro("geom_gentle.C");
67 gGeomGentle = geom_gentle();
ad5abc55 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
68ca2fe7 79 // Scenes
80
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.");
89
90 // Projection managers
91
92 gRPhiMgr = new TEveProjectionManager();
93 gRPhiMgr->SetProjection(TEveProjection::kPT_RPhi);
d4dbbb43 94 gEve->AddToListTree(gRPhiMgr, kFALSE);
68ca2fe7 95 {
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);
68ca2fe7 103 gRPhiGeomScene->AddElement(a);
104 }
105 gRPhiMgr->ImportElements(gGeomGentleRPhi, gRPhiGeomScene);
20dae051 106 if (gShowTRD) gRPhiMgr->ImportElements(gGeomGentleTRD, gRPhiGeomScene);
107 if (gShowMUONRPhi) gRPhiMgr->ImportElements(gGeomGentleMUON, gRPhiGeomScene);
f6afd0e1 108
68ca2fe7 109 gRhoZMgr = new TEveProjectionManager();
110 gRhoZMgr->SetProjection(TEveProjection::kPT_RhoZ);
d4dbbb43 111 gEve->AddToListTree(gRhoZMgr, kFALSE);
68ca2fe7 112 {
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);
68ca2fe7 120 gRhoZGeomScene->AddElement(a);
121 }
122 gRhoZMgr->ImportElements(gGeomGentleRhoZ, gRhoZGeomScene);
20dae051 123 if (gShowTRD) gRhoZMgr->ImportElements(gGeomGentleTRD, gRhoZGeomScene);
124 if (gShowMUONRhoZ) gRhoZMgr->ImportElements(gGeomGentleMUON, gRhoZGeomScene);
68ca2fe7 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 //==============================================================================
f6afd0e1 159
7b2d546e 160 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C", "kine_tracks", "", kFALSE));
6c841fa2 161
7b2d546e 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));
6c841fa2 164 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0", "t0_hits.C", "t0_hits", "", kFALSE));
a3e7341e 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));
6c841fa2 168
29207369 169 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE));
6c841fa2 170 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE));
29207369 171 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE));
29207369 172 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
a3e7341e 173 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE));
7b2d546e 174
ad5abc55 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
68ca2fe7 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"));
75b17362 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"));
73ce6137 189 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade"));
f6afd0e1 190
29207369 191 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE));
192 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE));
193 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
194
195 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
ad5abc55 196
5138b34a 197 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC", "esd_zdc.C", "esd_zdc", "", kFALSE));
198
5378a1b8 199 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus", "clusters.C+", "clusters", "", kFALSE));
7b2d546e 200 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C+", "its_clusters"));
201 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C+", "tpc_clusters"));
202 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters"));
203 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters"));
f6afd0e1 204
f6afd0e1 205
68ca2fe7 206 //==============================================================================
207 // Additional GUI components
208 //==============================================================================
209
210 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
211 slot->StartEmbedding();
f6afd0e1 212 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
68ca2fe7 213 slot->StopEmbedding("DataSelection");
f6afd0e1 214 exewin->PopulateMacros();
215
68ca2fe7 216 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
217 slot->StartEmbedding();
12365217 218 new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
68ca2fe7 219 slot->StopEmbedding("QA histograms");
12365217 220
f6afd0e1 221 browser->GetTabRight()->SetTab(1);
222
223 browser->StartEmbedding(TRootBrowser::kBottom);
4d62585e 224 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
f6afd0e1 225 browser->StopEmbedding("EventCtrl");
226
68ca2fe7 227 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
228 TEveWindowTab *store_tab = slot->MakeTab();
229 store_tab->SetElementNameTitle("WindowStore",
230 "Undocked windows whose previous container is not known\n"
231 "are placed here when the main-frame is closed.");
232 gEve->GetWindowManager()->SetDefaultContainer(store_tab);
233
234 //==============================================================================
235 // AliEve objects - global tools
236 //==============================================================================
237
238 AliEveTrackFitter* fitter = new AliEveTrackFitter();
239 gEve->AddToListTree(fitter, 1);
240 gEve->AddElement(fitter, gEve->GetEventScene());
241
242 AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
243 gEve->AddToListTree(g_trkcnt, kFALSE);
244
245
246 //==============================================================================
247 // Final stuff
248 //==============================================================================
249
250 // A refresh to show proper window.
251 gEve->Redraw3D(kTRUE);
252 gSystem->ProcessEvents();
253
254 // Register command to call on each event.
4d62585e 255 AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
256 AliEveEventManager::GetMaster()->GotoEvent(0);
f6afd0e1 257
258 gEve->EditElement(g_trkcnt);
259
260 gEve->Redraw3D(kTRUE);
261}
262
263/******************************************************************************/
264
265void on_new_event()
266{
f6afd0e1 267 AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance;
268 g_trkcnt->Reset();
4d62585e 269 g_trkcnt->SetEventId(AliEveEventManager::GetMaster()->GetEventId());
29207369 270
271 if (g_esd_tracks_by_category_container != 0)
272 {
273 TEveElementList* cont = g_esd_tracks_by_category_container;
274
275 // Here we expect several TEveTrackList containers.
276 // First two have reasonable primaries (sigma-to-prim-vertex < 5).
277 // Others are almost certainly secondaries.
278 Int_t count = 1;
279 TEveElement::List_i i = cont->BeginChildren();
280 while (i != cont->EndChildren())
281 {
282 TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
283 if (l != 0)
284 {
285 g_trkcnt->RegisterTracks(l, (count <= 2));
286 ++count;
287 }
288 ++i;
f6afd0e1 289 }
29207369 290
291 // Set it to zero, so that we do not reuse an old one.
292 g_esd_tracks_by_category_container = 0;
293 }
294 else
295 {
296 Warning("on_new_event", "g_esd_tracks_by_category_container not initialized.");
f6afd0e1 297 }
298
68ca2fe7 299 Double_t x[3] = { 0, 0, 0 };
2142305c 300
301 if (AliEveEventManager::HasESD())
f6afd0e1 302 {
2142305c 303 AliESDEvent* esd = AliEveEventManager::AssertESD();
304 esd->GetPrimaryVertex()->GetXYZ(x);
305
f6afd0e1 306 TTimeStamp ts(esd->GetTimeStamp());
307 TString win_title("Eve Main Window -- Timestamp: ");
308 win_title += ts.AsString("s");
309 win_title += "; Event # in ESD file: ";
310 win_title += esd->GetEventNumberInFile();
311 gEve->GetBrowser()->SetWindowName(win_title);
312 }
f6afd0e1 313
314 TEveElement* top = gEve->GetCurrentEvent();
315
29207369 316 if (gRPhiMgr && top)
317 {
68ca2fe7 318 gRPhiEventScene->DestroyElements();
319 if (gCenterProjectionsAtPrimaryVertex)
320 gRPhiMgr->SetCenter(x[0], x[1], x[2]);
321 gRPhiMgr->ImportElements(top, gRPhiEventScene);
f6afd0e1 322 }
29207369 323 if (gRhoZMgr && top)
324 {
68ca2fe7 325 gRhoZEventScene->DestroyElements();
326 if (gCenterProjectionsAtPrimaryVertex)
327 gRhoZMgr->SetCenter(x[0], x[1], x[2]);
328 gRhoZMgr->ImportElements(top, gRhoZEventScene);
f6afd0e1 329 }
f6afd0e1 330}