* esd_tracks.C
[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 **************************************************************************/
707b281a 9
84aff7a4 10#include <TInterpreter.h>
11#include <TRint.h>
12#include <TROOT.h>
a3e7341e 13#include <TPRegexp.h>
84aff7a4 14#include <TSystem.h>
15#include <TError.h>
16
c2c4b7a2 17#include <AliLog.h>
18
84aff7a4 19#include <TEveUtil.h>
20#include <TEveManager.h>
3f2dc5bd 21#include <TEveSelection.h>
5320a363 22#include <TEveBrowser.h>
5987168b 23
24#include <Getline.h>
25
26int main(int argc, char **argv)
27{
a15e6d7d 28 static const TEveException kEH("alieve::main");
84aff7a4 29
81515106 30 if (gSystem->Getenv("ALICE_ROOT") == 0)
31 {
32 Error(kEH.Data(), "ALICE_ROOT is not defined, aborting.");
33 gSystem->Exit(1);
84aff7a4 34 }
81515106 35
36 TString evedir(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
37
38 if (gSystem->AccessPathName(evedir) == kTRUE)
39 {
40 Error(kEH.Data(), "Directory $ALICE_ROOT/EVE does not exist.");
84aff7a4 41 gSystem->Exit(1);
42 }
43
44 TString macPath(gROOT->GetMacroPath());
81515106 45 macPath += Form(":%s/macros", evedir.Data());
46 gInterpreter->AddIncludePath(evedir);
47 if (gSystem->Getenv("ALICE_ROOT") != 0)
48 {
49 macPath += Form(":%s/alice-macros", evedir.Data());
707b281a 50 gInterpreter->AddIncludePath(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
84aff7a4 51 gInterpreter->AddIncludePath(Form("%s/include", gSystem->Getenv("ALICE_ROOT")));
52 gInterpreter->AddIncludePath(gSystem->Getenv("ALICE_ROOT"));
53 }
a3e7341e 54 {
55 // TabCom fails on double-colon in macro-path.
5320a363 56 // I fixed this in ROOT sometime ago ... could be removed
57 // when we go to 5.26.
a3e7341e 58 TPMERegexp doubleColon(":{2,}", "og");
59 doubleColon.Substitute(macPath, ":");
60 }
84aff7a4 61 gROOT->SetMacroPath(macPath);
62
ebbc41f8 63 // How to hadle AliLog properly?
3e6470df 64 AliLog *log = new AliLog;
65 TRint *app = new TRint("App", &argc, argv);
84aff7a4 66
67 TEveManager::Create();
5320a363 68 gEve->GetSelection()->SetPickToSelect(TEveSelection::kPS_PableCompound);
69 gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_PableCompound);
84aff7a4 70
86ee80cd 71 gEve->RegisterGeometryAlias("Default", Form("%s/alice-data/default_geo.root", evedir.Data()));
81515106 72
3e6470df 73 app->Run(kTRUE);
2418252a 74
5320a363 75 gEve->GetBrowser()->UnmapWindow();
2418252a 76 TEveManager::Terminate();
707b281a 77
3e6470df 78 app->Terminate(0);
79
ebbc41f8 80 delete log;
81
84aff7a4 82 return 0;
5987168b 83}