First version of the new GUI in development. You can enable this UI with "alieve...
[u/mrichter/AliRoot.git] / EVE / alieve_main / alieve_main.cxx
CommitLineData
d810d0de 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 *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
96d621f6 9#include <EveBase/AliEveConfigManager.h>
10
11#include <TInterpreter.h>
12#include <TRint.h>
13#include <TROOT.h>
14#include <TPRegexp.h>
15#include <TSystem.h>
16#include <TError.h>
17#include <RVersion.h>
18
19#include <AliLog.h>
20
21#include <TEveUtil.h>
22#include <TEveManager.h>
23#include <TEveSelection.h>
5320a363 24#include <TEveBrowser.h>
96d621f6 25#include <TEveViewer.h>
5987168b 26
96d621f6 27#include <Getline.h>
5987168b 28
2e29a658 29// DEV Version includes
30#include <EveBase/AliEveApplication.h>
31#include <EveBase/AliEveMainWindow.h>
32
5987168b 33int main(int argc, char **argv)
34{
2e29a658 35
36 if(argc>1)
37 {
38 if(strcmp(argv[1],"-dev")==0 ){
39
40 AliEveApplication app("AliEve", &argc, argv);
41 AliEveMainWindow alieve("ALICE Event Display");
42
43 app.Connect(&alieve, "CloseWindow()", "TApplication", &app, "Terminate(=0)" );
44 app.Run();
45
46 return 0;
47 }
48 }
49
50
51 static const TEveException kEH("alieve::main");
52
53 if (gSystem->Getenv("ALICE_ROOT") == 0)
54 {
55 Error(kEH.Data(), "ALICE_ROOT is not defined, aborting.");
56 gSystem->Exit(1);
57 }
58
59 TString evedir(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
60
61 if (gSystem->AccessPathName(evedir) == kTRUE)
62 {
63 Error(kEH.Data(), "Directory $ALICE_ROOT/EVE does not exist.");
64 gSystem->Exit(1);
65 }
66
67 TString macPath(gROOT->GetMacroPath());
68 macPath += Form(":%s/macros", evedir.Data());
69 gInterpreter->AddIncludePath(evedir);
70 if (gSystem->Getenv("ALICE_ROOT") != 0)
71 {
72 macPath += Form(":%s/alice-macros", evedir.Data());
73 gInterpreter->AddIncludePath(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
74 gInterpreter->AddIncludePath(Form("%s/PWG0", gSystem->Getenv("ALICE_ROOT")));
75 gInterpreter->AddIncludePath(Form("%s/include", gSystem->Getenv("ALICE_ROOT")));
76 gInterpreter->AddIncludePath(gSystem->Getenv("ALICE_ROOT"));
77 }
78 {
79 // TabCom fails on double-colon in macro-path.
80 // I fixed this in ROOT sometime ago ... could be removed
81 // when we go to 5.26.
82 TPMERegexp doubleColon(":{2,}", "og");
83 doubleColon.Substitute(macPath, ":");
84 }
85 gROOT->SetMacroPath(macPath);
86
87 // make sure logger is instantiated
88 AliLog::GetRootLogger();
89 TRint *app = new TRint("App", &argc, argv);
96d621f6 90
91#if ROOT_VERSION_CODE >= ROOT_VERSION(5,25,4) || defined XXX_LATEST_ROOT
2e29a658 92 // Waiting for update by Pawel. Now GED in ROOT is better again :)
93 // Uncomment when fixed in AliEveGedXXX.
94 // TEveGListTreeEditorFrame::SetEditorClass("AliEveGedEditor");
96d621f6 95#endif
96
2e29a658 97 TEveManager::Create();
98 gEve->GetDefaultViewer()->SetElementName("3D View");
99 gEve->GetSelection()->SetPickToSelect(TEveSelection::kPS_PableCompound);
100 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_PableCompound);
101
102 gEve->RegisterGeometryAlias("Default", Form("%s/alice-data/default_geo.root", evedir.Data()));
96d621f6 103
2e29a658 104 try {AliEveConfigManager::InitializeMaster();}
105 catch (TEveException exc) {
106 AliErrorGeneral("alieve_main",exc.Data());
107 }
96d621f6 108
2e29a658 109 app->Connect( "TEveBrowser", "CloseWindow()", "TRint", app, "Terminate(=0)");
96d621f6 110
2e29a658 111 app->Run(kTRUE);
96d621f6 112
2e29a658 113 if (gEve && gEve->GetBrowser()) gEve->GetBrowser()->UnmapWindow();
96d621f6 114
2e29a658 115 TEveManager::Terminate();
116 app->Terminate(0);
cf0bca8c 117
2e29a658 118 if(gEve) {delete gEve; gEve = 0;}
cf0bca8c 119
96d621f6 120
2e29a658 121 return 0;
5987168b 122}