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