Merging STORAGE-dev to master
[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{
164d3d29 35 static const TEveException kEH("alieve::main");
36
2e29a658 37 if(argc>1)
38 {
39 if(strcmp(argv[1],"-dev")==0 ){
40
41 AliEveApplication app("AliEve", &argc, argv);
42 AliEveMainWindow alieve("ALICE Event Display");
43
44 app.Connect(&alieve, "CloseWindow()", "TApplication", &app, "Terminate(=0)" );
45 app.Run();
46
47 return 0;
48 }
49 }
164d3d29 50 else
51 {
52 Info(kEH.Data(),"No parameters");
53 }
54
2e29a658 55 if (gSystem->Getenv("ALICE_ROOT") == 0)
56 {
57 Error(kEH.Data(), "ALICE_ROOT is not defined, aborting.");
58 gSystem->Exit(1);
59 }
60
61 TString evedir(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
62
63 if (gSystem->AccessPathName(evedir) == kTRUE)
64 {
65 Error(kEH.Data(), "Directory $ALICE_ROOT/EVE does not exist.");
66 gSystem->Exit(1);
67 }
68
69 TString macPath(gROOT->GetMacroPath());
70 macPath += Form(":%s/macros", evedir.Data());
71 gInterpreter->AddIncludePath(evedir);
72 if (gSystem->Getenv("ALICE_ROOT") != 0)
73 {
74 macPath += Form(":%s/alice-macros", evedir.Data());
75 gInterpreter->AddIncludePath(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
76 gInterpreter->AddIncludePath(Form("%s/PWG0", gSystem->Getenv("ALICE_ROOT")));
77 gInterpreter->AddIncludePath(Form("%s/include", gSystem->Getenv("ALICE_ROOT")));
78 gInterpreter->AddIncludePath(gSystem->Getenv("ALICE_ROOT"));
79 }
80 {
81 // TabCom fails on double-colon in macro-path.
82 // I fixed this in ROOT sometime ago ... could be removed
83 // when we go to 5.26.
84 TPMERegexp doubleColon(":{2,}", "og");
85 doubleColon.Substitute(macPath, ":");
86 }
87 gROOT->SetMacroPath(macPath);
88
89 // make sure logger is instantiated
90 AliLog::GetRootLogger();
91 TRint *app = new TRint("App", &argc, argv);
96d621f6 92
93#if ROOT_VERSION_CODE >= ROOT_VERSION(5,25,4) || defined XXX_LATEST_ROOT
2e29a658 94 // Waiting for update by Pawel. Now GED in ROOT is better again :)
95 // Uncomment when fixed in AliEveGedXXX.
96 // TEveGListTreeEditorFrame::SetEditorClass("AliEveGedEditor");
96d621f6 97#endif
98
2e29a658 99 TEveManager::Create();
100 gEve->GetDefaultViewer()->SetElementName("3D View");
101 gEve->GetSelection()->SetPickToSelect(TEveSelection::kPS_PableCompound);
102 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_PableCompound);
103
104 gEve->RegisterGeometryAlias("Default", Form("%s/alice-data/default_geo.root", evedir.Data()));
96d621f6 105
2e29a658 106 try {AliEveConfigManager::InitializeMaster();}
107 catch (TEveException exc) {
108 AliErrorGeneral("alieve_main",exc.Data());
109 }
96d621f6 110
2e29a658 111 app->Connect( "TEveBrowser", "CloseWindow()", "TRint", app, "Terminate(=0)");
96d621f6 112
2e29a658 113 app->Run(kTRUE);
96d621f6 114
2e29a658 115 if (gEve && gEve->GetBrowser()) gEve->GetBrowser()->UnmapWindow();
96d621f6 116
2e29a658 117 TEveManager::Terminate();
118 app->Terminate(0);
cf0bca8c 119
2e29a658 120 if(gEve) {delete gEve; gEve = 0;}
cf0bca8c 121
96d621f6 122
2e29a658 123 return 0;
5987168b 124}