- made OCDB configuration object for the HLT TPCTrackHisto component
[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
f6afd0e1 64 TEveUtil::LoadMacro("geom_gentle.C");
3545fba9 65 gMultiView->InitGeomGentle(geom_gentle(),
66 geom_gentle_rphi(),
67 geom_gentle_rhoz());
68
69 if (gShowTrd) {
f6afd0e1 70 TEveUtil::LoadMacro("geom_gentle_trd.C");
3545fba9 71 gMultiView->InitGeomGentleTrd(geom_gentle_trd());
f6afd0e1 72 }
f6afd0e1 73
3545fba9 74 if (gShowMuonRPhi || gShowMuonRhoZ) {
75 TEveUtil::LoadMacro("geom_gentle_muon.C");
76 gMultiView->InitGeomGentleMuon(geom_gentle_muon(kFALSE), gShowMuonRPhi, gShowMuonRhoZ);
68ca2fe7 77 }
20dae051 78
79
80 //==============================================================================
81 // Registration of per-event macros
82 //==============================================================================
83
84 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track", "kine_tracks.C", "kine_tracks", "", kFALSE));
85
86 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit ITS", "its_hits.C", "its_hits", "", kFALSE));
87 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit TPC", "tpc_hits.C", "tpc_hits", "", kFALSE));
88 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit T0", "t0_hits.C", "t0_hits", "", kFALSE));
89 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hit FMD", "fmd_hits.C", "fmd_hits", "", kFALSE));
90
1eda7a67 91 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG ITS", "its_digits.C", "its_digits", "", kFALSE));
20dae051 92 exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD", "fmd_digits.C", "fmd_digits", "", kFALSE));
93
1eda7a67 94 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS", "its_raw.C", "its_raw", "", kFALSE));
20dae051 95 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC", "tpc_raw.C", "tpc_raw", "", kFALSE));
96 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0", "t0_raw.C", "t0_raw", "", kFALSE));
97 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD", "fmd_raw.C", "fmd_raw", "", kFALSE));
98 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO", "vzero_raw.C", "vzero_raw", "", kFALSE));
99 exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE", "acorde_raw.C", "acorde_raw", "", kFALSE));
100
101 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex", "", kTRUE));
102 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse", "", kTRUE));
103 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box", "kFALSE, 3, 3, 3", kFALSE));
104 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_spd", "", kTRUE));
105 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_spd", "", kTRUE));
106 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_spd", "kFALSE, 3, 3, 3", kFALSE));
107 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX", "primary_vertex.C", "primary_vertex_tpc", "", kFALSE));
108 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse", "primary_vertex.C", "primary_vertex_ellipse_tpc", "", kFALSE));
109 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box", "primary_vertex.C", "primary_vertex_box_tpc", "kFALSE, 3, 3, 3", kFALSE));
110
111 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_onfly"));
112 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0_points.C", "esd_V0_points_offline"));
113 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0", "esd_V0.C", "esd_V0"));
114 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C", "esd_cascade_points"));
115 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C", "esd_cascade"));
4711ad43 116 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink_points.C", "esd_kink_points"));
117 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink.C", "esd_kink"));
20dae051 118
119 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks", "", kFALSE));
120 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI", "", kFALSE));
121 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
122
3a20f984 123 exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kTRUE));
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
143 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
144 slot->StartEmbedding();
145 AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
146 slot->StopEmbedding("DataSelection");
147 exewin->PopulateMacros();
148
149 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
150 slot->StartEmbedding();
151 new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
152 slot->StopEmbedding("QA histograms");
153
008ac94c 154 //event selection tab
155 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
156 slot->StartEmbedding();
157 new AliEveEventSelectorWindow(gClient->GetRoot(), 600, 400, AliEveEventManager::GetMaster()->GetEventSelector());
158 slot->StopEmbedding("Selections");
159
20dae051 160 browser->GetTabRight()->SetTab(1);
161
162 browser->StartEmbedding(TRootBrowser::kBottom);
163 new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
164 browser->StopEmbedding("EventCtrl");
165
166 slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
167 TEveWindowTab *store_tab = slot->MakeTab();
168 store_tab->SetElementNameTitle("WindowStore",
169 "Undocked windows whose previous container is not known\n"
170 "are placed here when the main-frame is closed.");
171 gEve->GetWindowManager()->SetDefaultContainer(store_tab);
68ca2fe7 172
3545fba9 173
20dae051 174 //==============================================================================
175 // AliEve objects - global tools
176 //==============================================================================
177
178 AliEveTrackFitter* fitter = new AliEveTrackFitter();
179 gEve->AddToListTree(fitter, 1);
180 gEve->AddElement(fitter, gEve->GetEventScene());
181
182 AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
183 gEve->AddToListTree(g_trkcnt, kFALSE);
184
185
186 //==============================================================================
187 // Final stuff
188 //==============================================================================
189
190 // A refresh to show proper window.
191 gEve->Redraw3D(kTRUE);
192 gSystem->ProcessEvents();
193
194 // Register command to call on each event.
4d62585e 195 AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
196 AliEveEventManager::GetMaster()->GotoEvent(0);
e9b9f7d2 197
ca49b003 198 gEve->EditElement(g_trkcnt);
199
e9b9f7d2 200 gEve->Redraw3D(kTRUE);
201}
202
203/******************************************************************************/
204
205void on_new_event()
206{
f76c9e9b 207 AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance;
e9b9f7d2 208 g_trkcnt->Reset();
4d62585e 209 g_trkcnt->SetEventId(AliEveEventManager::GetMaster()->GetEventId());
29207369 210
20dae051 211 if (g_esd_tracks_by_category_container != 0)
df56539f 212 {
20dae051 213 TEveElementList* cont = g_esd_tracks_by_category_container;
214
215 // Here we expect several TEveTrackList containers.
216 // First two have reasonable primaries (sigma-to-prim-vertex < 5).
217 // Others are almost certainly secondaries.
218 Int_t count = 1;
219 TEveElement::List_i i = cont->BeginChildren();
220 while (i != cont->EndChildren())
29207369 221 {
20dae051 222 TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
223 if (l != 0)
224 {
225 g_trkcnt->RegisterTracks(l, (count <= 2));
226 ++count;
227 }
228 ++i;
e9b9f7d2 229 }
20dae051 230
231 // Set it to zero, so that we do not reuse an old one.
232 g_esd_tracks_by_category_container = 0;
233 }
234 else
235 {
236 Warning("on_new_event", "g_esd_tracks_by_category_container not initialized.");
e9b9f7d2 237 }
238
3a20f984 239 TEveTrackList *tracklets = dynamic_cast<TEveTrackList*>(gEve->GetCurrentEvent()->FindChild("SPD Tracklets"));
240 if (tracklets)
241 {
242 g_trkcnt->RegisterTracklets(tracklets, kTRUE);
243 }
244 else
245 {
246 Warning("on_new_event", "'SPD Tracklets' not found.");
247 }
248
20dae051 249 Double_t x[3] = { 0, 0, 0 };
250
251 if (AliEveEventManager::HasESD())
a27140cb 252 {
20dae051 253 AliESDEvent* esd = AliEveEventManager::AssertESD();
254 esd->GetPrimaryVertex()->GetXYZ(x);
255
a27140cb 256 TTimeStamp ts(esd->GetTimeStamp());
257 TString win_title("Eve Main Window -- Timestamp: ");
258 win_title += ts.AsString("s");
5858bcbe 259 win_title += "; Event # in ESD file: ";
a27140cb 260 win_title += esd->GetEventNumberInFile();
261 gEve->GetBrowser()->SetWindowName(win_title);
262 }
e9b9f7d2 263
264 TEveElement* top = gEve->GetCurrentEvent();
265
3545fba9 266 gMultiView->DestroyEventRPhi();
267 if (gCenterProjectionsAtPrimaryVertex)
268 gMultiView->SetCenterRPhi(x[0], x[1], x[2]);
269 gMultiView->ImportEventRPhi(top);
270
271 gMultiView->DestroyEventRhoZ();
272 if (gCenterProjectionsAtPrimaryVertex)
273 gMultiView->SetCenterRhoZ(x[0], x[1], x[2]);
274 gMultiView->ImportEventRhoZ(top);
e9b9f7d2 275}