]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alieve_main/alieve_main.cxx
Bug #56834: Fix by Matevz, tested locally and at P2.
[u/mrichter/AliRoot.git] / EVE / alieve_main / alieve_main.cxx
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          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #include <TInterpreter.h>
11 #include <TRint.h>
12 #include <TROOT.h>
13 #include <TPRegexp.h>
14 #include <TSystem.h>
15 #include <TError.h>
16
17 #include <AliLog.h>
18
19 #include <TEveUtil.h>
20 #include <TEveManager.h>
21 #include <TEveSelection.h>
22
23 #include <Getline.h>
24
25 int main(int argc, char **argv)
26 {
27   static const TEveException kEH("alieve::main");
28
29   if (gSystem->Getenv("ALICE_ROOT") == 0)
30   {
31     Error(kEH.Data(), "ALICE_ROOT is not defined, aborting.");
32     gSystem->Exit(1);
33   }
34
35   TString evedir(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
36
37   if (gSystem->AccessPathName(evedir) == kTRUE)
38   {
39     Error(kEH.Data(), "Directory $ALICE_ROOT/EVE does not exist.");
40     gSystem->Exit(1);
41   }
42
43   TString macPath(gROOT->GetMacroPath());
44   macPath += Form(":%s/macros", evedir.Data());
45   gInterpreter->AddIncludePath(evedir);
46   if (gSystem->Getenv("ALICE_ROOT") != 0)
47   {
48     macPath += Form(":%s/alice-macros", evedir.Data());
49     gInterpreter->AddIncludePath(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
50     gInterpreter->AddIncludePath(Form("%s/include", gSystem->Getenv("ALICE_ROOT")));
51     gInterpreter->AddIncludePath(gSystem->Getenv("ALICE_ROOT"));
52   }
53   {
54     // TabCom fails on double-colon in macro-path.
55     TPMERegexp doubleColon(":{2,}", "og");
56     doubleColon.Substitute(macPath, ":");
57   }
58   gROOT->SetMacroPath(macPath);
59
60   // How to hadle AliLog properly?
61   AliLog* log = new AliLog;
62
63   TRint app("App", &argc, argv);
64
65   TEveManager::Create();
66   gEve->GetSelection()->SetPickToSelect(TEveSelection::kPS_Projectable);
67   gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_Projectable);
68
69   gEve->RegisterGeometryAlias("Default", Form("%s/alice-data/default_geo.root", evedir.Data()));
70
71   app.Run(kTRUE);
72
73   TEveManager::Terminate();
74
75   delete log;
76
77   return 0;
78 }