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