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