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