Update master to aliroot
[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 **************************************************************************/
0919d3a8 9#include <AliEveConfigManager.h>
96d621f6 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
0919d3a8 30#include <AliEveApplication.h>
31#include <AliEveMainWindow.h>
2e29a658 32
7f97b015 33
34#include <iostream>
35using namespace std;
36
5987168b 37int main(int argc, char **argv)
38{
572d0620 39 if (gSystem->Getenv("ALICE_ROOT") == 0){
40 cout<<"ALICE_ROOT is not defined, aborting."<<endl;
2e29a658 41 gSystem->Exit(1);
42 }
43
44 TString evedir(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
45
572d0620 46 if (gSystem->AccessPathName(evedir) == kTRUE){
47 cout<<"Directory $ALICE_ROOT/EVE does not exist."<<endl;
2e29a658 48 gSystem->Exit(1);
49 }
50
51 TString macPath(gROOT->GetMacroPath());
52 macPath += Form(":%s/macros", evedir.Data());
53 gInterpreter->AddIncludePath(evedir);
572d0620 54 macPath += Form(":%s/alice-macros", evedir.Data());
55 gInterpreter->AddIncludePath(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
56 gInterpreter->AddIncludePath(Form("%s/PWG0", gSystem->Getenv("ALICE_ROOT")));
57 gInterpreter->AddIncludePath(Form("%s/include", gSystem->Getenv("ALICE_ROOT")));
58 gInterpreter->AddIncludePath(gSystem->Getenv("ALICE_ROOT"));
59
60 // TabCom fails on double-colon in macro-path.
61 // I fixed this in ROOT sometime ago ... could be removed
62 // when we go to 5.26.
63// TPMERegexp doubleColon(":{2,}", "og");
64// doubleColon.Substitute(macPath, ":");
65
2e29a658 66 gROOT->SetMacroPath(macPath);
67
68 // make sure logger is instantiated
69 AliLog::GetRootLogger();
572d0620 70 TRint *app = new TRint("App", &argc, argv);
96d621f6 71
2e29a658 72 TEveManager::Create();
73 gEve->GetDefaultViewer()->SetElementName("3D View");
74 gEve->GetSelection()->SetPickToSelect(TEveSelection::kPS_PableCompound);
75 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_PableCompound);
2e29a658 76 gEve->RegisterGeometryAlias("Default", Form("%s/alice-data/default_geo.root", evedir.Data()));
96d621f6 77
572d0620 78 try {
79 AliEveConfigManager::InitializeMaster();
80 }
2e29a658 81 catch (TEveException exc) {
572d0620 82 cout<<"\n\nException while initializing config manager"<<endl;
2e29a658 83 AliErrorGeneral("alieve_main",exc.Data());
84 }
96d621f6 85
572d0620 86 app->Connect("TEveBrowser", "CloseWindow()", "TRint", app, "Terminate()");
2e29a658 87 app->Run(kTRUE);
96d621f6 88
2e29a658 89 if (gEve && gEve->GetBrowser()) gEve->GetBrowser()->UnmapWindow();
2e29a658 90 TEveManager::Terminate();
2e29a658 91 if(gEve) {delete gEve; gEve = 0;}
7f97b015 92
572d0620 93 app->Terminate(0);
2e29a658 94 return 0;
5987168b 95}