Move MultiView.C into EveBase class AliEveMultiView.
[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
78 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C", "kine_tracks", "", kFALSE));
79
80 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit ITS", "its_hits.C", "its_hits", "", kFALSE));
81 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit TPC", "tpc_hits.C", "tpc_hits", "", kFALSE));
82 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0", "t0_hits.C", "t0_hits", "", kFALSE));
83 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit FMD", "fmd_hits.C", "fmd_hits", "", kFALSE));
84
1eda7a67 85 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG ITS", "its_digits.C", "its_digits", "", kFALSE));
391fa967 86 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG TPC", "tpc_digits.C", "tpc_digits", "", kFALSE));
87 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG TOF", "tof_digits.C", "tof_digits", "", kFALSE));
88 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG HMPID", "hmpid_digits.C","hmpid_digits","", kFALSE));
20dae051 89 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD", "fmd_digits.C", "fmd_digits", "", kFALSE));
90
1eda7a67 91 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS", "its_raw.C", "its_raw", "", kFALSE));
20dae051 92 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE));
391fa967 93 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TOF", "tof_raw.C", "tof_raw", "", kFALSE));
94 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW HMPID", "hmpid_raw.C", "hmpid_raw", "", kFALSE));
20dae051 95 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE));
96 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE));
97 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
98 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE));
99
100 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE));
101 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE));
102 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
103 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE));
104 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE));
105 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
106 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE));
107 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE));
108 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
109
110 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_onfly"));
111 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_offline"));
112 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0.C", "esd_V0"));
113 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C", "esd_cascade_points"));
114 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade"));
4711ad43 115 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink_points.C", "esd_kink_points"));
116 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink.C", "esd_kink"));
20dae051 117
5320a363 118 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE));
119 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE));
120 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
121 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_anal_cuts", "", kFALSE));
20dae051 122
1e9caa37 123 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
20dae051 124
125 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC", "esd_zdc.C", "esd_zdc", "", kFALSE));
126
127 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus", "clusters.C+", "clusters", "", kFALSE));
128 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus ITS", "its_clusters.C+", "its_clusters"));
129 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "tpc_clusters.C+", "tpc_clusters"));
130 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters"));
131 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters"));
132
08b0f222 133 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "vplot_tpc.C+", "vplot_tpc", "", kFALSE));
134
f8d5a389 135 exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA HF", "aod_HF.C", "aod_HF", "", kFALSE));
08b0f222 136 exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE));
20dae051 137
3545fba9 138
20dae051 139 //==============================================================================
140 // Additional GUI components
141 //==============================================================================
142
51158ea3 143 // Macro / data selection
20dae051 144 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
145 slot->StartEmbedding();
146 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
147 slot->StopEmbedding("DataSelection");
148 exewin->PopulateMacros();
149
51158ea3 150 // Event selection tab
20dae051 151 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
152 slot->StartEmbedding();
51158ea3 153 new AliEveEventSelectorWindow(gClient->GetRoot(), 600, 400, AliEveEventManager::GetMaster()->GetEventSelector());
154 slot->StopEmbedding("Selections");
20dae051 155
51158ea3 156 // QA viewer
008ac94c 157 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
158 slot->StartEmbedding();
51158ea3 159 new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
160 slot->StopEmbedding("QA histograms");
008ac94c 161
20dae051 162 browser->GetTabRight()->SetTab(1);
163
164 browser->StartEmbedding(TRootBrowser::kBottom);
165 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
166 browser->StopEmbedding("EventCtrl");
167
168 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
169 TEveWindowTab *store_tab = slot->MakeTab();
170 store_tab->SetElementNameTitle("WindowStore",
171 "Undocked windows whose previous container is not known\n"
172 "are placed here when the main-frame is closed.");
173 gEve->GetWindowManager()->SetDefaultContainer(store_tab);
68ca2fe7 174
3545fba9 175
20dae051 176 //==============================================================================
177 // AliEve objects - global tools
178 //==============================================================================
179
180 AliEveTrackFitter* fitter = new AliEveTrackFitter();
181 gEve->AddToListTree(fitter, 1);
182 gEve->AddElement(fitter, gEve->GetEventScene());
183
184 AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
185 gEve->AddToListTree(g_trkcnt, kFALSE);
186
187
188 //==============================================================================
189 // Final stuff
190 //==============================================================================
191
192 // A refresh to show proper window.
193 gEve->Redraw3D(kTRUE);
194 gSystem->ProcessEvents();
195
196 // Register command to call on each event.
4d62585e 197 AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
198 AliEveEventManager::GetMaster()->GotoEvent(0);
e9b9f7d2 199
ca49b003 200 gEve->EditElement(g_trkcnt);
201
e9b9f7d2 202 gEve->Redraw3D(kTRUE);
203}
204
205/******************************************************************************/
206
207void on_new_event()
208{
20dae051 209 Double_t x[3] = { 0, 0, 0 };
210
211 if (AliEveEventManager::HasESD())
a27140cb 212 {
20dae051 213 AliESDEvent* esd = AliEveEventManager::AssertESD();
214 esd->GetPrimaryVertex()->GetXYZ(x);
215
a27140cb 216 TTimeStamp ts(esd->GetTimeStamp());
217 TString win_title("Eve Main Window -- Timestamp: ");
218 win_title += ts.AsString("s");
5858bcbe 219 win_title += "; Event # in ESD file: ";
a27140cb 220 win_title += esd->GetEventNumberInFile();
221 gEve->GetBrowser()->SetWindowName(win_title);
222 }
e9b9f7d2 223
224 TEveElement* top = gEve->GetCurrentEvent();
225
1e9caa37 226 AliEveMultiView *mv = AliEveMultiView::Instance();
227
228 mv->DestroyEventRPhi();
3545fba9 229 if (gCenterProjectionsAtPrimaryVertex)
1e9caa37 230 mv->SetCenterRPhi(x[0], x[1], x[2]);
231 mv->ImportEventRPhi(top);
3545fba9 232
1e9caa37 233 mv->DestroyEventRhoZ();
3545fba9 234 if (gCenterProjectionsAtPrimaryVertex)
1e9caa37 235 mv->SetCenterRhoZ(x[0], x[1], x[2]);
236 mv->ImportEventRhoZ(top);
e9b9f7d2 237}