]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/macros/visscan_init.C
3cd9ebf51d42d88ab5da679eb63a4c9785973900
[u/mrichter/AliRoot.git] / EVE / macros / visscan_init.C
1 // $Id$
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 class AliEveMacroExecutor;
11 class TEveProjectionManager;
12 class TEveGeoShape;
13 class TEveUtil;
14
15
16 Bool_t gShowTrd      = kTRUE;
17 Bool_t gShowMuonRPhi = kFALSE;
18 Bool_t gShowMuonRhoZ = kTRUE;
19
20 Bool_t gCenterProjectionsAtPrimaryVertex = kFALSE;
21
22
23 void visscan_init(const TString& cdburi = "",
24                   const TString& path   = ".", Bool_t show_extra_geo = kFALSE)
25 {
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
32   if (!show_extra_geo)
33   {
34     gShowTrd = gShowMuonRPhi = gShowMuonRhoZ = kFALSE;
35   }
36
37   AliEveEventManager::AddAODfriend("AliAOD.VertexingHF.root");
38
39   TEveUtil::LoadMacro("alieve_init.C");
40   alieve_init(cdburi, path, -1);
41
42   // TEveLine::SetDefaultSmooth(1);
43
44   TEveUtil::AssertMacro("VizDB_scan.C");
45
46   AliEveMacroExecutor *exec    = AliEveEventManager::GetMaster()->GetExecutor();
47   TEveBrowser         *browser = gEve->GetBrowser();
48   browser->ShowCloseTab(kFALSE);
49
50
51   //==============================================================================
52   // Geometry, scenes, projections and viewers
53   //==============================================================================
54
55   AliEveMultiView *mv = new AliEveMultiView;
56
57   mv->SetDepth(-10);
58
59   TEveUtil::LoadMacro("geom_gentle.C");
60   mv->InitGeomGentle(geom_gentle(), geom_gentle_rphi(), geom_gentle_rhoz());
61
62   if (gShowTrd) {
63     TEveUtil::LoadMacro("geom_gentle_trd.C");
64     mv->InitGeomGentleTrd(geom_gentle_trd());
65   }
66
67   if (gShowMuonRPhi || gShowMuonRhoZ) {
68     TEveUtil::LoadMacro("geom_gentle_muon.C");
69     mv->InitGeomGentleMuon(geom_gentle_muon(kFALSE), gShowMuonRPhi, gShowMuonRhoZ);
70   }
71
72   mv->SetDepth(0);
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
85   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG ITS",     "its_digits.C",  "its_digits",  "", kFALSE));
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));
89   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD",     "fmd_digits.C",  "fmd_digits",  "", kFALSE));
90
91   exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS",     "its_raw.C",     "its_raw",     "", kFALSE));
92   exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC",     "tpc_raw.C",     "tpc_raw",     "", kFALSE));
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));
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"));
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"));
117
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));
122
123   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
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
133   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "vplot_tpc.C+",    "vplot_tpc", "", kFALSE));
134
135   exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA HF",   "aod_HF.C",   "aod_HF",   "", kFALSE));
136   exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE));
137
138
139   //==============================================================================
140   // Additional GUI components
141   //==============================================================================
142
143   // Macro / data selection
144   slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
145   slot->StartEmbedding();
146   AliEveMacroExecutorWindow* exewin = new AliEveMacroExecutorWindow(exec);
147   slot->StopEmbedding("DataSelection");
148   exewin->PopulateMacros();
149
150   // Event selection tab
151   slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
152   slot->StartEmbedding();
153   new AliEveEventSelectorWindow(gClient->GetRoot(), 600, 400, AliEveEventManager::GetMaster()->GetEventSelector());
154   slot->StopEmbedding("Selections");
155
156   // QA viewer
157   slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
158   slot->StartEmbedding();
159   new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
160   slot->StopEmbedding("QA histograms");
161
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);
174
175
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->GetViewers()->SwitchColorSet();
194   gEve->Redraw3D(kTRUE);
195   gSystem->ProcessEvents();
196
197   // Register command to call on each event.
198   AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
199   AliEveEventManager::GetMaster()->GotoEvent(0);
200
201   gEve->EditElement(g_trkcnt);
202
203   gEve->Redraw3D(kTRUE);
204 }
205
206 /******************************************************************************/
207
208 void on_new_event()
209 {
210   Double_t x[3] = { 0, 0, 0 };
211
212   if (AliEveEventManager::HasESD())
213   {
214     AliESDEvent* esd = AliEveEventManager::AssertESD();
215     esd->GetPrimaryVertex()->GetXYZ(x);
216
217     TTimeStamp ts(esd->GetTimeStamp());
218     TString win_title("Eve Main Window -- Timestamp: ");
219     win_title += ts.AsString("s");
220     win_title += "; Event # in ESD file: ";
221     win_title += esd->GetEventNumberInFile();
222     gEve->GetBrowser()->SetWindowName(win_title);
223   }
224
225   TEveElement* top = gEve->GetCurrentEvent();
226
227   AliEveMultiView *mv = AliEveMultiView::Instance();
228
229   mv->DestroyEventRPhi();
230   if (gCenterProjectionsAtPrimaryVertex)
231     mv->SetCenterRPhi(x[0], x[1], x[2]);
232   mv->ImportEventRPhi(top);
233
234   mv->DestroyEventRhoZ();
235   if (gCenterProjectionsAtPrimaryVertex)
236     mv->SetCenterRhoZ(x[0], x[1], x[2]);
237   mv->ImportEventRhoZ(top);
238 }