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