264a1c48bf765b60bda20cfa920ff1dfdb505d00
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveMainWindow.cxx
1 #include <TG3DLine.h>
2 #include <TGButton.h>
3 #include <TGMenu.h>
4 #include <TGPicture.h>
5 #include <TGToolBar.h>
6 #include <TGMsgBox.h>
7
8 #include <TGrid.h>
9 #include <TSystem.h>
10 #include <TInterpreter.h>
11 #include <TROOT.h>
12
13
14
15 #include <TEveManager.h>
16 #include <TEveSelection.h>
17
18 #include <AliEveEventManager.h>
19 #include <AliEveMultiView.h>
20 #include <AliEveMacro.h>
21 #include <AliEveMacroExecutor.h>
22 #include <AliEveTrackFitter.h>
23 #include <AliEveTrackCounter.h>
24
25 #include "../alice-macros/geom_gentle.C"
26 #include "../alice-macros/geom_gentle_trd.C"
27 #include "../alice-macros/geom_gentle_muon.C"
28
29
30 #include "AliEveMainWindow.h"
31 #include "AliEveUtil.h"
32 #include "AliEveFileDialog.h"
33
34 #include <iostream>
35 using namespace std;
36
37 AliEveMainWindow::AliEveMainWindow(const char* title, UInt_t width, UInt_t height)
38     : TGMainFrame(gClient->GetRoot(), width, height),
39       fEve(0),
40       fFileDialog(0)
41 {
42
43     AliEveUtil::Init();
44     fPicturePool = AliEveUtil::GetPicturePool();
45
46     static const TEveException kEH("AliEveMainWindow::AliEveMainWindow");
47
48     if(!fPicturePool) cout<< "Couldnt get a PicturePool"<<endl;
49
50
51     fEve = TEveManager::Create(kFALSE, "V");
52     gEve->GetDefaultViewer()->SetElementName("3D View");
53     gEve->GetSelection()->SetPickToSelect(TEveSelection::kPS_PableCompound);
54     gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_PableCompound);
55
56     TString evedir(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
57     gEve->RegisterGeometryAlias("Default", Form("%s/alice-data/default_geo.root", evedir.Data()));
58
59     setupMenus();
60     setupToolbars();
61
62     TGFrame* viewFrame = gEve->GetDefaultViewer()->GetGUIFrame();
63     viewFrame->MapWindow();
64     viewFrame->ReparentWindow(this);
65
66     AddFrame(viewFrame, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY , 3, 3, 3, 3));
67
68     SetWindowName(title);
69     Resize(width,height);
70     MapSubwindows();
71     MapWindow();
72     Layout();
73
74     gEve->Redraw3D(kTRUE);
75     gSystem->ProcessEvents();
76 }
77
78 AliEveMainWindow::~AliEveMainWindow()
79 {
80     if(fEve) delete fEve;
81 }
82
83 void AliEveMainWindow::onMenuFileItem(UInt_t id)
84 {
85     switch(id){
86     case MENU_FILE_OPEN:
87     {
88         if(!fFileDialog) fFileDialog = new AliEveFileDialog( gClient->GetRoot(), this, kAliEveFDLocal);
89
90         fFileDialog->setMode(kAliEveFDLocal);
91         fFileDialog->MapWindow();
92         if(fFileDialog->accepted()) openFile(fFileDialog->GetPathESD());
93         break;
94     }
95     case MENU_FILE_OPEN_URL:
96     {
97         if(!fFileDialog) fFileDialog = new AliEveFileDialog( gClient->GetRoot(), this, kAliEveFDRemote);
98
99         fFileDialog->setMode(kAliEveFDRemote);
100         fFileDialog->MapWindow();
101         if(fFileDialog->accepted()) openFile(fFileDialog->GetUrl());
102
103         break;
104     }
105     default:
106     {
107         break;
108     }
109     }
110 }
111
112 void AliEveMainWindow::onMenuEditItem(UInt_t id)
113 {
114
115 }
116
117 void AliEveMainWindow::onMenuViewItem(UInt_t id)
118 {
119
120 }
121
122 void AliEveMainWindow::onMenuGoItem(UInt_t id)
123 {
124     switch(id){
125     case MENU_GO_NEXT_EVENT:
126     {
127         AliEveEventManager::GetMaster()->NextEvent();
128         break;
129     }
130     case MENU_GO_PREV_EVENT:
131     {
132         AliEveEventManager::GetMaster()->PrevEvent();
133         break;
134     }
135     default:
136     {
137         break;
138     }
139     }
140
141     TEveElement* top = gEve->GetCurrentEvent();
142
143     AliEveMultiView *mv = AliEveMultiView::Instance();
144
145     //mv->DestroyEventRPhi();
146     mv->ImportEventRPhi(top);
147     //mv->DestroyEventRhoZ();
148     mv->ImportEventRhoZ(top);
149
150     gEve->Redraw3D(kTRUE);
151 }
152
153 void AliEveMainWindow::setupMenus()
154 {
155     fMenuBar = new TGMenuBar(this);
156
157     // File Menu
158     fMenuFile = new TGPopupMenu(gClient->GetRoot());
159     fMenuFile->AddEntry("&Open...", MENU_FILE_OPEN, 0, fPicturePool->GetPicture("menu/document-open.png"));
160     fMenuFile->AddEntry("&Open URL...", MENU_FILE_OPEN_URL, 0, fPicturePool->GetPicture("menu/document-open-remote.png"));
161     fMenuFile->AddSeparator();
162     fMenuFile->AddEntry("&Connect To Server...", MENU_FILE_OPEN_CONNECTION, 0, fPicturePool->GetPicture("menu/network-connect.png"));
163     fMenuFile->AddSeparator();
164     fMenuFile->AddEntry("Export View(s)...", MENU_FILE_EXPORT_VIEWS, 0, fPicturePool->GetPicture("menu/document-export.png"));
165     fMenuFile->AddSeparator();
166     fMenuFile->AddEntry("E&xit", MENU_FILE_EXIT, 0, fPicturePool->GetPicture("menu/application-exit.png"));
167     // --
168
169     // Edit Menu
170     fMenuEdit = new TGPopupMenu(gClient->GetRoot());
171     fMenuEdit->AddEntry("&Undo",   MENU_EDIT_UNDO, 0, fPicturePool->GetPicture("menu/edit-undo.png"));
172     fMenuEdit->AddEntry("&Redo",   MENU_EDIT_REDO, 0, fPicturePool->GetPicture("menu/edit-redo.png"));
173     fMenuEdit->AddSeparator();
174     fMenuEdit->AddEntry("&Cut",   MENU_EDIT_CUT, 0, fPicturePool->GetPicture("menu/edit-cut.png"));
175     fMenuEdit->AddEntry("C&opy",  MENU_EDIT_COPY, 0, fPicturePool->GetPicture("menu/edit-copy.png"));
176     fMenuEdit->AddEntry("&Paste", MENU_EDIT_PASTE, 0, fPicturePool->GetPicture("menu/edit-paste.png"));
177     fMenuEdit->AddEntry("&Delete",MENU_EDIT_DELETE, 0, fPicturePool->GetPicture("menu/edit-delete.png"));
178     fMenuEdit->AddSeparator();
179     fMenuEdit->AddEntry("P&references", MENU_EDIT_PROP, 0, fPicturePool->GetPicture("menu/document-properties.png"));
180     // --
181
182     // View Menu
183     fMenuView = new TGPopupMenu(gClient->GetRoot());
184
185     fMenuViewToolbars = new TGPopupMenu(gClient->GetRoot());
186     fMenuViewToolbars->AddEntry("&Main Toolbar", MENU_VIEW_TOOLBAR_MAIN);
187     fMenuViewToolbars->AddEntry("&Navigation Toolbar", MENU_VIEW_TOOLBAR_NAV);
188     fMenuView->AddPopup("Toolbars", fMenuViewToolbars);
189
190     fMenuViewSidebars = new TGPopupMenu(gClient->GetRoot());
191     fMenuViewSidebars->AddEntry("Hi&story", MENU_VIEW_TOOLBAR_HIST);
192     fMenuViewSidebars->AddEntry("&Properties", MENU_VIEW_TOOLBAR_NAV);
193     fMenuView->AddPopup("Sidebars", fMenuViewSidebars);
194
195     fMenuView->AddSeparator();
196     fMenuView->AddEntry("&Reload", MENU_VIEW_RELOAD, 0, fPicturePool->GetPicture("menu/view-refresh.png"));
197     fMenuView->AddSeparator();
198     fMenuView->AddEntry("Zoom &In", MENU_VIEW_ZOOM_IN, 0, fPicturePool->GetPicture("menu/zoom-in.png"));
199     fMenuView->AddEntry("Zoom &Out",MENU_VIEW_ZOOM_OUT, 0, fPicturePool->GetPicture("menu/zoom-out.png"));
200     fMenuView->AddEntry("Zoom &Reset",MENU_VIEW_ZOOM_RESET, 0, fPicturePool->GetPicture("menu/zoom-original.png"));
201     // --
202
203     // Go Menu
204     fMenuGo = new TGPopupMenu(gClient->GetRoot());
205     fMenuGo->AddEntry("&Next Event",   MENU_GO_NEXT_EVENT, 0, fPicturePool->GetPicture("navigation/media-seek-forward.png"));
206     fMenuGo->AddEntry("P&revious Event",   MENU_GO_PREV_EVENT, 0, fPicturePool->GetPicture("navigation/media-seek-backward.png"));
207     fMenuGo->AddSeparator();
208     fMenuGo->AddEntry("&First Event", MENU_GO_FIRST_EVENT,0, fPicturePool->GetPicture("navigation/media-skip-backward.png"));
209     fMenuGo->AddEntry("&Last Event",  MENU_GO_LAST_EVENT, 0, fPicturePool->GetPicture("navigation/media-skip-forward.png"));
210     fMenuGo->AddSeparator();
211     fMenuGo->AddEntry("&Play", MENU_GO_PLAY, 0, fPicturePool->GetPicture("navigation/media-playback-start.png"));
212     // --
213
214     // Tools Menu
215     fMenuTools = new TGPopupMenu(gClient->GetRoot());
216     fMenuTools->AddEntry("&QA Histograms", MENU_TOOLS_QA);
217     fMenuTools->AddEntry("&Macros", MENU_TOOLS_MACROS);
218     // --
219
220     // Help Menu
221     fMenuHelp = new TGPopupMenu(gClient->GetRoot());
222     fMenuHelp->AddEntry("&Contents", MENU_HELP_CONTENTS, 0, fPicturePool->GetPicture("menu/help-contents.png"));
223     fMenuHelp->AddEntry("&About", MENU_HELP_ABOUT, 0, fPicturePool->GetPicture("menu/help-about.png"));
224     // --
225
226     // Add popupmenus to MenuBar
227     fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
228     fMenuBar->AddPopup("&Edit", fMenuEdit, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
229     fMenuBar->AddPopup("&View", fMenuView, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
230     fMenuBar->AddPopup("&Go", fMenuGo, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
231     fMenuBar->AddPopup("&Tools", fMenuTools, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
232     fMenuBar->AddPopup("&Help", fMenuHelp, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
233
234     // MenuBar to the window
235     AddFrame(fMenuBar,  new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX));
236
237     // Menu signals
238     fMenuFile->Connect("Activated(Int_t)", "AliEveMainWindow", this, "onMenuFileItem(Int_t)");
239     fMenuEdit->Connect("Activated(Int_t)", "AliEveMainWindow", this, "onMenuEditItem(Int_t)");
240     fMenuView->Connect("Activated(Int_t)", "AliEveMainWindow", this, "onMenuViewItem(Int_t)");
241     fMenuGo->Connect("Activated(Int_t)", "AliEveMainWindow", this, "onMenuGoItem(Int_t)");
242 }
243
244 void AliEveMainWindow::setupToolbars()
245 {
246     TGMenuEntry* tmpMenuEntry;
247
248     fToolBar = new TGToolBar(this);
249
250     tmpMenuEntry = fMenuFile->GetEntry("Open...");
251     fToolBar->AddButton(this, new TGPictureButton(fToolBar, tmpMenuEntry->GetPic(), tmpMenuEntry->GetEntryId() ));
252     tmpMenuEntry = fMenuFile->GetEntry("Open URL...");
253     fToolBar->AddButton(this, new TGPictureButton(fToolBar, tmpMenuEntry->GetPic(), tmpMenuEntry->GetEntryId() ));
254     tmpMenuEntry = fMenuFile->GetEntry("Connect To Server...");
255     fToolBar->AddButton(this, new TGPictureButton(fToolBar, tmpMenuEntry->GetPic(), tmpMenuEntry->GetEntryId() ));
256     tmpMenuEntry = fMenuFile->GetEntry("Export View(s)...");
257     fToolBar->AddButton(this, new TGPictureButton(fToolBar, tmpMenuEntry->GetPic(), tmpMenuEntry->GetEntryId() ));
258
259     fToolBar->AddFrame(new TGVertical3DLine(fToolBar),  new TGLayoutHints(kLHintsExpandY));
260
261     tmpMenuEntry = fMenuView->GetEntry("Reload");
262     fToolBar->AddButton(this, new TGPictureButton(fToolBar, tmpMenuEntry->GetPic(), tmpMenuEntry->GetEntryId() ));
263     tmpMenuEntry = fMenuView->GetEntry("Zoom In");
264     fToolBar->AddButton(this, new TGPictureButton(fToolBar, tmpMenuEntry->GetPic(), tmpMenuEntry->GetEntryId() ));
265     tmpMenuEntry = fMenuView->GetEntry("Zoom Out");
266     fToolBar->AddButton(this, new TGPictureButton(fToolBar, tmpMenuEntry->GetPic(), tmpMenuEntry->GetEntryId() ));
267     tmpMenuEntry = fMenuView->GetEntry("Zoom Reset");
268     fToolBar->AddButton(this, new TGPictureButton(fToolBar, tmpMenuEntry->GetPic(), tmpMenuEntry->GetEntryId() ));
269
270
271
272
273     AddFrame(new TGHorizontal3DLine(this), new TGLayoutHints(kLHintsExpandX));
274     AddFrame(fToolBar, new TGLayoutHints(kLHintsNormal));
275     AddFrame(new TGHorizontal3DLine(this), new TGLayoutHints(kLHintsExpandX));
276
277
278
279     //fToolBar->Connect("Clicked(Int_t)", "RCMainWindow", this, "openFile()");
280 }
281
282 void AliEveMainWindow::openFile(const TString& path)
283 {
284     Info("AliEveMainWindow::openFile",  "Trying to open the file [%s]", path.Data());
285
286     TString esdFile = fFileDialog->GetPathESD();
287     TString aodFile = fFileDialog->GetPathAOD();
288     TString aodFriendFile = fFileDialog->GetPathAODfriend();
289     TString rawFile = fFileDialog->GetPathRaw();
290     TString cdbUri = fFileDialog->GetCDBStoragePath();
291
292     Info("AliEveMainWindow::openFile", "ESD:%s AOD:%s AODfriend:%s RAW:%s CDB:%s", esdFile.Data(), aodFile.Data(), aodFriendFile.Data(), rawFile.Data(), cdbUri.Data());
293
294     TEveUtil::AssertMacro("VizDB_scan.C");
295
296     AliEveEventManager::SetESDFileName(esdFile);
297     AliEveEventManager::SetAODFileName(aodFile);
298     AliEveEventManager::AddAODfriend(aodFriendFile);
299     AliEveEventManager::SetRawFileName(rawFile);
300     AliEveEventManager::SetCdbUri(cdbUri);
301
302     // Open event
303     if (path.BeginsWith("alien:"))
304     {
305         if (gGrid != 0)
306         {
307             Info("AliEveMainWindow::openFile", "TGrid already initializied. Skiping checks and initialization.");
308         }
309         else
310         {
311             Info("AliEveMainWindow::openFile", "AliEn requested - connecting.");
312             if (gSystem->Getenv("GSHELL_ROOT") == 0)
313             {
314                 Error("AliEveMainWindow::openFile", "AliEn environment not initialized. Aborting.");
315                 new TGMsgBox(gClient->GetRoot(), this, "AliEve", "AliEn environment not initialized. Aborting.", kMBIconStop);
316                 return;
317             }
318             if (TGrid::Connect("alien") == 0)
319             {
320                 Error("AliEveMainWindow::openFile", "TGrid::Connect() failed. Aborting.");
321                 new TGMsgBox(gClient->GetRoot(), this, "AliEve", "TGrid::Connect() failed. Aborting.", kMBIconStop);
322                 return;
323             }
324         }
325     }
326
327     TString name("Event"); // CINT has trouble with direct "Event".
328     new AliEveEventManager(name, path, 0);
329     gEve->AddEvent(AliEveEventManager::GetMaster());
330
331     TEveUtil::AssertMacro("VizDB_scan.C");
332
333     AliEveMacroExecutor *exec    = AliEveEventManager::GetMaster()->GetExecutor();
334     //==============================================================================
335     // Geometry, scenes, projections and viewers
336     //==============================================================================
337
338     AliEveMultiView *mv = new AliEveMultiView;
339
340     mv->SetDepth(-10);
341
342     TEveUtil::LoadMacro("geom_gentle.C");
343     mv->InitGeomGentle(geom_gentle(), geom_gentle_rphi(), geom_gentle_rhoz(), 0);
344
345
346     TEveUtil::LoadMacro("geom_gentle_trd.C");
347     mv->InitGeomGentleTrd(geom_gentle_trd());
348
349     TEveUtil::LoadMacro("geom_gentle_muon.C");
350     mv->InitGeomGentleMuon(geom_gentle_muon(kFALSE), kTRUE, kTRUE, kFALSE);
351
352     mv->SetDepth(0);
353
354     //==============================================================================
355     // Registration of per-event macros
356     //==============================================================================
357
358     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Track",   "kine_tracks.C", "kine_tracks", "", kFALSE));
359
360     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits ITS", "its_hits.C",    "its_hits",    "", kFALSE));
361     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits TPC", "tpc_hits.C",    "tpc_hits",    "", kFALSE));
362     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits T0",  "t0_hits.C",     "t0_hits",     "", kFALSE));
363     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits FMD", "fmd_hits.C",    "fmd_hits",    "", kFALSE));
364     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits ACORDE", "acorde_hits.C",    "acorde_hits",    "", kFALSE));
365     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits EMCAL", "emcal_hits.C",    "emcal_hits",    "", kFALSE));
366     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits TOF",  "tof_hits.C",     "tof_hits",     "", kFALSE));
367     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits TRD", "trd_hits.C",    "trd_hits",    "", kFALSE));
368     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM Hits VZERO", "vzero_hits.C",    "vzero_hits",    "", kFALSE));
369
370     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG ITS",     "its_digits.C",  "its_digits",  "", kFALSE));
371     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG TPC",     "tpc_digits.C",  "tpc_digits",  "", kFALSE));
372     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG TOF",     "tof_digits.C",  "tof_digits",  "", kFALSE));
373     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG HMPID",   "hmpid_digits.C","hmpid_digits","", kFALSE));
374     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG FMD",     "fmd_digits.C",  "fmd_digits",  "", kFALSE));
375
376     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ITS",     "its_raw.C",     "its_raw",     "", kFALSE));
377     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TPC",     "tpc_raw.C",     "tpc_raw",     "", kFALSE));
378     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW TOF",     "tof_raw.C",     "tof_raw",     "", kFALSE));
379     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW HMPID",   "hmpid_raw.C",   "hmpid_raw",   "", kFALSE));
380     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW T0",      "t0_raw.C",      "t0_raw",      "", kFALSE));
381     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW FMD",     "fmd_raw.C",     "fmd_raw",     "", kFALSE));
382     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW VZERO",   "vzero_raw.C",   "vzero_raw",   "", kFALSE));
383     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW ACORDE",  "acorde_raw.C",  "acorde_raw",  "", kFALSE));
384
385     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX",             "primary_vertex.C", "primary_vertex",             "",                kTRUE));
386     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse",     "primary_vertex.C", "primary_vertex_ellipse",     "",                kTRUE));
387     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box",         "primary_vertex.C", "primary_vertex_box",         "kFALSE, 3, 3, 3", kFALSE));
388     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX SPD",         "primary_vertex.C", "primary_vertex_spd",         "",                kTRUE));
389     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse SPD", "primary_vertex.C", "primary_vertex_ellipse_spd", "",                kTRUE));
390     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box SPD",     "primary_vertex.C", "primary_vertex_box_spd",     "kFALSE, 3, 3, 3", kFALSE));
391     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX TPC",         "primary_vertex.C", "primary_vertex_tpc",         "",                kFALSE));
392     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Ellipse TPC", "primary_vertex.C", "primary_vertex_ellipse_tpc", "",                kFALSE));
393     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC PVTX Box TPC",     "primary_vertex.C", "primary_vertex_box_tpc",     "kFALSE, 3, 3, 3", kFALSE));
394
395     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0",   "esd_V0_points.C",       "esd_V0_points_onfly"));
396     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0",   "esd_V0_points.C",       "esd_V0_points_offline"));
397     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC V0",   "esd_V0.C",              "esd_V0"));
398     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade_points.C",  "esd_cascade_points"));
399     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC CSCD", "esd_cascade.C",         "esd_cascade"));
400     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink_points.C",     "esd_kink_points"));
401     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC KINK", "esd_kink.C",            "esd_kink"));
402
403     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks",              "esd_tracks.C", "esd_tracks",              "", kFALSE));
404     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks ITS standalone",          "esd_tracks.C", "esd_tracks_ITS_standalone",              "", kFALSE));
405     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks ITS",          "esd_tracks.C", "esd_tracks_ITS",              "", kFALSE));
406     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks TPC",           "esd_tracks.C", "esd_tracks_TPC",              "", kFALSE));
407     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks MI",           "esd_tracks.C", "esd_tracks_MI",           "", kFALSE));
408     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks by category",  "esd_tracks.C", "esd_tracks_by_category",  "", kTRUE));
409     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks by anal cuts", "esd_tracks.C", "esd_tracks_by_anal_cuts", "", kFALSE));
410     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks Lego", "lego.C", "lego", "", kFALSE));
411     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks Beams Info", "beams_info.C", "beams_info", "", kFALSE));
412
413     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklets SPD", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kTRUE));
414
415     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC",      "esd_zdc.C", "esd_zdc", "", kFALSE));
416
417     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters",     "clusters.C",     "clusters", "", kFALSE));
418     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters ITS", "its_clusters.C", "its_clusters"));
419     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters TPC", "tpc_clusters.C", "tpc_clusters"));
420     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters TRD", "trd_clusters.C", "trd_clusters"));
421     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters TOF", "tof_clusters.C", "tof_clusters"));
422     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters HMPID", "hmpid_clusters.C", "hmpid_clusters"));
423     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters PHOS", "phos_clusters.C", "phos_clusters"));
424
425     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters TPC", "vplot_tpc.C",    "vplot_tpc", "", kFALSE));
426
427     exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA HF",   "aod_HF.C",   "aod_HF",   "", kFALSE));
428     exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE));
429
430     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "DUMP VZERO",   "vzero_dump.C",   "vzero_dump",   "", kFALSE));
431
432
433     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "SIM TrackRef MUON", "muon_trackRefs.C", "muon_trackRefs", "kTRUE", kFALSE));
434     exec->AddMacro(new AliEveMacro(AliEveMacro::kRawReader, "RAW MUON", "muon_raw.C", "muon_raw", "", kFALSE));
435     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "DIG MUON", "muon_digits.C", "muon_digits", "", kFALSE));
436     exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clusters MUON", "muon_clusters.C", "muon_clusters", "", kTRUE));
437     exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracks MUON", "esd_muon_tracks.C", "esd_muon_tracks", "kTRUE,kFALSE", kTRUE));
438
439
440     //==============================================================================
441     // AliEve objects - global tools
442     //==============================================================================
443
444     AliEveTrackFitter* fitter = new AliEveTrackFitter();
445     gEve->AddToListTree(fitter, 1);
446     gEve->AddElement(fitter, gEve->GetEventScene());
447
448     AliEveTrackCounter* g_trkcnt = new AliEveTrackCounter("Primary Counter");
449     gEve->AddToListTree(g_trkcnt, kFALSE);
450
451     // A refresh to show proper window.
452     //gEve->GetViewers()->SwitchColorSet();
453     gEve->Redraw3D(kTRUE);
454     gSystem->ProcessEvents();
455
456     // Register command to call on each event.
457     // AliEveEventManager::GetMaster()->AddNewEventCommand("on_new_event();");
458     AliEveEventManager::GetMaster()->GotoEvent(0);
459
460     gEve->Redraw3D(kTRUE);
461 }
462