]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alieve_main/alihlteve_main.cxx
Coverity
[u/mrichter/AliRoot.git] / EVE / alieve_main / alihlteve_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 <EveBase/AliEveConfigManager.h>
11
12 #include <TInterpreter.h>
13 #include <TRint.h>
14 #include <TROOT.h>
15 #include <TPRegexp.h>
16 #include <TSystem.h>
17 #include <TError.h>
18 #include <RVersion.h>
19
20 #include <AliLog.h>
21
22 #include <TEveUtil.h>
23 #include <TEveManager.h>
24 #include <TEveSelection.h>
25 #include <TEveBrowser.h>
26
27 #include <Getline.h>
28
29 int main(int argc, char **argv)
30 {
31   static const TEveException kEH("alihlteve::main");
32
33   if (gSystem->Getenv("ALICE_ROOT") == 0)
34   {
35     Error(kEH.Data(), "ALICE_ROOT is not defined, aborting.");
36     gSystem->Exit(1);
37   }
38
39   TString evedir(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
40
41   if (gSystem->AccessPathName(evedir) == kTRUE)
42   {
43     Error(kEH.Data(), "Directory $ALICE_ROOT/EVE does not exist.");
44     gSystem->Exit(1);
45   }
46
47   TString macPath(gROOT->GetMacroPath());
48   macPath += Form(":%s/macros", evedir.Data());
49   gInterpreter->AddIncludePath(evedir);
50   if (gSystem->Getenv("ALICE_ROOT") != 0)
51   {
52     macPath += Form(":%s/alice-macros", evedir.Data());
53     gInterpreter->AddIncludePath(Form("%s/EVE", gSystem->Getenv("ALICE_ROOT")));
54     gInterpreter->AddIncludePath(Form("%s/PWG0", gSystem->Getenv("ALICE_ROOT")));
55     gInterpreter->AddIncludePath(Form("%s/include", gSystem->Getenv("ALICE_ROOT")));
56     gInterpreter->AddIncludePath(gSystem->Getenv("ALICE_ROOT"));
57   }
58   {
59     // TabCom fails on double-colon in macro-path.
60     // I fixed this in ROOT sometime ago ... could be removed
61     // when we go to 5.26.
62     TPMERegexp doubleColon(":{2,}", "og");
63     doubleColon.Substitute(macPath, ":");
64   }
65   gROOT->SetMacroPath(macPath);
66
67   // get a logger instance
68   //  AliLog *log =  // JMT to fix warning
69   AliLog::GetRootLogger();
70   TRint  *app = new TRint("App", &argc, argv);
71
72 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,25,4) || defined XXX_LATEST_ROOT
73   // Waiting for update by Pawel. Now GED in ROOT is better again :)
74   // Uncomment when fixed in AliEveGedXXX.
75   // TEveGListTreeEditorFrame::SetEditorClass("AliEveGedEditor");
76 #endif
77
78   TEveManager::Create();
79   gEve->GetSelection()->SetPickToSelect(TEveSelection::kPS_PableCompound);
80   gEve->GetHighlight()->SetPickToSelect(TEveSelection::kPS_PableCompound);
81
82   gEve->RegisterGeometryAlias("Default", Form("%s/alice-data/default_geo.root", evedir.Data()));
83
84         try {AliEveConfigManager::InitializeMaster();}
85         catch (TEveException exc) {
86                 AliErrorGeneral("alihlteve_main",exc.Data());
87         }
88
89   app->Run(kTRUE);
90
91   if (gEve && gEve->GetBrowser())
92     gEve->GetBrowser()->UnmapWindow();
93   TEveManager::Terminate();
94
95   app->Terminate(0);
96
97   //  delete log;
98
99   return 0;
100 }