From Stefano:
[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;
e9b9f7d2 11class TEveProjectionManager;
12class TEveGeoShape;
13class TEveUtil;
4f222c66 14class TSystem;
15class TInterpreter;
e9b9f7d2 16
20dae051 17
3545fba9 18Bool_t gShowMuonRPhi = kFALSE;
19Bool_t gShowMuonRhoZ = kTRUE;
20dae051 20
21Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
e9b9f7d2 22
c63f2997 23
24void visscan_init(const TString& cdburi = "",
4f222c66 25 const TString& path = ".",
26 Bool_t showMuon = kTRUE,
27 Bool_t showTrd = kFALSE)
e9b9f7d2 28{
4f222c66 29
30 if (showMuon)
31 {
32 if (gSystem->Getenv("ALICE_ROOT") != 0)
33 {
34 gInterpreter->AddIncludePath(Form("%s/MUON", gSystem->Getenv("ALICE_ROOT")));
35 gInterpreter->AddIncludePath(Form("%s/MUON/mapping", gSystem->Getenv("ALICE_ROOT")));
36 }
37 }
38 else
39 {
40 gShowMuonRPhi = gShowMuonRhoZ = kFALSE;
41 }
42
c63f2997 43 if (cdburi.IsNull() && ! AliCDBManager::Instance()->IsDefaultStorageSet())
44 {
45 gEnv->SetValue("Root.Stacktrace", "no");
46 Fatal("visscan_init.C", "OCDB path MUST be specified as the first argument.");
47 }
48
f8d5a389 49 AliEveEventManager::AddAODfriend("AliAOD.VertexingHF.root");
50
e9b9f7d2 51 TEveUtil::LoadMacro("alieve_init.C");
c63f2997 52 alieve_init(cdburi, path, -1);
e9b9f7d2 53
20dae051 54 // TEveLine::SetDefaultSmooth(1);
e9b9f7d2 55
20dae051 56 TEveUtil::AssertMacro("VizDB_scan.C");
57
58 AliEveMacroExecutor *exec = AliEveEventManager::GetMaster()->GetExecutor();
59 TEveBrowser *browser = gEve->GetBrowser();
3545fba9 60 browser->ShowCloseTab(kFALSE);
61
20dae051 62
63 //==============================================================================
64 // Geometry, scenes, projections and viewers
65 //==============================================================================
66
1e9caa37 67 AliEveMultiView *mv = new AliEveMultiView;
20dae051 68
1e9caa37 69 mv->SetDepth(-10);
4267948f 70
f6afd0e1 71 TEveUtil::LoadMacro("geom_gentle.C");
1e9caa37 72 mv->InitGeomGentle(geom_gentle(), geom_gentle_rphi(), geom_gentle_rhoz());
3545fba9 73
4f222c66 74 if (showTrd) {
f6afd0e1 75 TEveUtil::LoadMacro("geom_gentle_trd.C");
1e9caa37 76 mv->InitGeomGentleTrd(geom_gentle_trd());
f6afd0e1 77 }
f6afd0e1 78
3545fba9 79 if (gShowMuonRPhi || gShowMuonRhoZ) {
80 TEveUtil::LoadMacro("geom_gentle_muon.C");
1e9caa37 81 mv->InitGeomGentleMuon(geom_gentle_muon(kFALSE), gShowMuonRPhi, gShowMuonRhoZ);
68ca2fe7 82 }
20dae051 83
1e9caa37 84 mv->SetDepth(0);
20dae051 85
86 //==============================================================================
87 // Registration of per-event macros
88 //==============================================================================
89
15c12442 90 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C+", "kine_tracks", "", kFALSE));
20dae051 91
9dcd42ea 92 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits ITS", "its_hits.C", "its_hits", "", kFALSE));
93 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits TPC", "tpc_hits.C", "tpc_hits", "", kFALSE));
94 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits T0", "t0_hits.C", "t0_hits", "", kFALSE));
95 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits FMD", "fmd_hits.C", "fmd_hits", "", kFALSE));
199f125c 96 // exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits ACORDE", "acorde_hits.C", "acorde_hits", "", kFALSE));
97 // exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits EMCAL", "emcal_hits.C", "emcal_hits", "", kFALSE));
98 // exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits TOF", "tof_hits.C", "tof_hits", "", kFALSE));
99 // exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits TRD", "trd_hits.C", "trd_hits", "", kFALSE));
100 // exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits VZERO", "vzero_hits.C", "vzero_hits", "", kFALSE));
20dae051 101
1eda7a67 102 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG ITS", "its_digits.C", "its_digits", "", kFALSE));
391fa967 103 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG TPC", "tpc_digits.C", "tpc_digits", "", kFALSE));
104 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG TOF", "tof_digits.C", "tof_digits", "", kFALSE));
105 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG HMPID", "hmpid_digits.C","hmpid_digits","", kFALSE));
20dae051 106 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD", "fmd_digits.C", "fmd_digits", "", kFALSE));
107
1eda7a67 108 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS", "its_raw.C", "its_raw", "", kFALSE));
20dae051 109 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE));
391fa967 110 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TOF", "tof_raw.C", "tof_raw", "", kFALSE));
111 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW HMPID", "hmpid_raw.C", "hmpid_raw", "", kFALSE));
20dae051 112 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE));
113 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE));
114 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
115 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE));
116
3aff0c2e 117 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C+", "primary_vertex", "", kTRUE));
118 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C+", "primary_vertex_ellipse", "", kTRUE));
119 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C+", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
30650838 120 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX SPD", "primary_vertex.C+", "primary_vertex_spd", "", kTRUE));
121 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse SPD", "primary_vertex.C+", "primary_vertex_ellipse_spd", "", kTRUE));
122 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box SPD", "primary_vertex.C+", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
123 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX TPC", "primary_vertex.C+", "primary_vertex_tpc", "", kFALSE));
124 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse TPC", "primary_vertex.C+", "primary_vertex_ellipse_tpc", "", kFALSE));
125 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box TPC", "primary_vertex.C+", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
20dae051 126
127 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_onfly"));
128 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_offline"));
129 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0.C", "esd_V0"));
130 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C", "esd_cascade_points"));
131 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade"));
4711ad43 132 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink_points.C", "esd_kink_points"));
133 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink.C", "esd_kink"));
20dae051 134
3aff0c2e 135 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks", "esd_tracks.C+", "esd_tracks", "", kFALSE));
7b4a06f8 136 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks ITS standalone", "esd_tracks.C+", "esd_tracks_ITS_standalone", "", kFALSE));
8e37954c 137 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks ITS", "esd_tracks.C+", "esd_tracks_ITS", "", kFALSE));
138 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks TPC", "esd_tracks.C+", "esd_tracks_TPC", "", kFALSE));
3aff0c2e 139 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks MI", "esd_tracks.C+", "esd_tracks_MI", "", kFALSE));
140 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks by category", "esd_tracks.C+", "esd_tracks_by_category", "", kTRUE));
141 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks by anal cuts", "esd_tracks.C+", "esd_tracks_by_anal_cuts", "", kFALSE));
3d94b490 142 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks Lego", "lego.C", "lego", "", kTRUE));
6e994a7b 143 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks Beams Info", "beams_info.C", "beams_info", "", kTRUE));
20dae051 144
3aff0c2e 145 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklets SPD", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kTRUE));
20dae051 146
147 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC", "esd_zdc.C", "esd_zdc", "", kFALSE));
148
9dcd42ea 149 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters", "clusters.C+", "clusters", "", kFALSE));
150 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters ITS", "its_clusters.C+", "its_clusters"));
151 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters TPC", "tpc_clusters.C+", "tpc_clusters"));
152 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters TRD", "trd_clusters.C+", "trd_clusters"));
153 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters TOF", "tof_clusters.C+", "tof_clusters"));
199f125c 154 // exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters HMPID", "hmpid_clusters.C+", "hmpid_clusters"));
155 // exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters PHOS", "phos_clusters.C+", "phos_clusters"));
20dae051 156
9dcd42ea 157 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters TPC", "vplot_tpc.C+", "vplot_tpc", "", kFALSE));
08b0f222 158
f8d5a389 159 exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA HF", "aod_HF.C", "aod_HF", "", kFALSE));
08b0f222 160 exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE));
20dae051 161
9b5db6d1 162 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "DUMP VZERO", "vzero_dump.C", "vzero_dump", "", kFALSE));
4f222c66 163
164 if (showMuon)
165 {
166 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM TrackRef MUON", "muon_trackRefs.C+", "muon_trackRefs", "kTRUE", kFALSE));
167 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW MUON", "muon_raw.C+", "muon_raw", "", kFALSE));
168 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG MUON", "muon_digits.C+", "muon_digits", "", kFALSE));
169 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters MUON", "muon_clusters.C+", "muon_clusters", "", kTRUE));
170 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks MUON", "esd_muon_tracks.C+", "esd_muon_tracks", "kTRUE,kFALSE", kTRUE));
171 }
3545fba9 172
20dae051 173 //==============================================================================
174 // Additional GUI components
175 //==============================================================================
176
51158ea3 177 // Macro / data selection
20dae051 178 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
179 slot->StartEmbedding();
180 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
181 slot->StopEmbedding("DataSelection");
182 exewin->PopulateMacros();
183
51158ea3 184 // Event selection tab
20dae051 185 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
186 slot->StartEmbedding();
51158ea3 187 new AliEveEventSelectorWindow(gClient->GetRoot(), 600, 400, AliEveEventManager::GetMaster()->GetEventSelector());
188 slot->StopEmbedding("Selections");
20dae051 189
51158ea3 190 // QA viewer
008ac94c 191 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
192 slot->StartEmbedding();
51158ea3 193 new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
194 slot->StopEmbedding("QA histograms");
008ac94c 195
20dae051 196 browser->GetTabRight()->SetTab(1);
197
198 browser->StartEmbedding(TRootBrowser::kBottom);
199 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
200 browser->StopEmbedding("EventCtrl");
201
202 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
203 TEveWindowTab *store_tab = slot->MakeTab();
204 store_tab->SetElementNameTitle("WindowStore",
205 "Undocked windows whose previous container is not known\n"
206 "are placed here when the main-frame is closed.");
207 gEve->GetWindowManager()->SetDefaultContainer(store_tab);
68ca2fe7 208
3545fba9 209
20dae051 210 //==============================================================================
211 // AliEve objects - global tools
212 //==============================================================================
213
214 AliEveTrackFitter* fitter = new AliEveTrackFitter();
215 gEve->AddToListTree(fitter, 1);
216 gEve->AddElement(fitter, gEve->GetEventScene());
217
218 AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
219 gEve->AddToListTree(g_trkcnt, kFALSE);
220
221
222 //==============================================================================
223 // Final stuff
224 //==============================================================================
225
226 // A refresh to show proper window.
3cb3592a 227 gEve->GetViewers()->SwitchColorSet();
20dae051 228 gEve->Redraw3D(kTRUE);
229 gSystem->ProcessEvents();
230
231 // Register command to call on each event.
4d62585e 232 AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
233 AliEveEventManager::GetMaster()->GotoEvent(0);
e9b9f7d2 234
ca49b003 235 gEve->EditElement(g_trkcnt);
236
e9b9f7d2 237 gEve->Redraw3D(kTRUE);
238}
239
240/******************************************************************************/
241
242void on_new_event()
243{
20dae051 244 Double_t x[3] = { 0, 0, 0 };
245
246 if (AliEveEventManager::HasESD())
a27140cb 247 {
20dae051 248 AliESDEvent* esd = AliEveEventManager::AssertESD();
249 esd->GetPrimaryVertex()->GetXYZ(x);
250
a27140cb 251 TTimeStamp ts(esd->GetTimeStamp());
252 TString win_title("Eve Main Window -- Timestamp: ");
253 win_title += ts.AsString("s");
5858bcbe 254 win_title += "; Event # in ESD file: ";
a27140cb 255 win_title += esd->GetEventNumberInFile();
256 gEve->GetBrowser()->SetWindowName(win_title);
257 }
e9b9f7d2 258
259 TEveElement* top = gEve->GetCurrentEvent();
260
1e9caa37 261 AliEveMultiView *mv = AliEveMultiView::Instance();
262
3d94b490 263 //mv->DestroyEventRPhi();
3545fba9 264 if (gCenterProjectionsAtPrimaryVertex)
1e9caa37 265 mv->SetCenterRPhi(x[0], x[1], x[2]);
266 mv->ImportEventRPhi(top);
3545fba9 267
3d94b490 268 //mv->DestroyEventRhoZ();
3545fba9 269 if (gCenterProjectionsAtPrimaryVertex)
1e9caa37 270 mv->SetCenterRhoZ(x[0], x[1], x[2]);
271 mv->ImportEventRhoZ(top);
e9b9f7d2 272}