source: tags/Mars-V0.8.3/macros/rootlogon.C

Last change on this file was 2558, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.7 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25Bool_t isloaded()
26{
27 TString str = gSystem->GetLibraries("libmars.so");
28
29 return !str.IsNull();
30}
31
32void unload()
33{
34 if (!isloaded())
35 return;
36
37 cout << "Unloading 'libmars.so'... " << flush;
38 if (gSystem->Unload("libmars.so"))
39 cout << "error." << endl;
40 else
41 cout << "done." << endl << endl;
42}
43
44bool load(TString &dir)
45{
46 if (isloaded())
47 return;
48
49 cout << "\033[33m\033[1m" << "Loading '" << dir << "libmars.so'... " << "\033[0m" << flush;
50
51 if (dir.IsNull())
52 dir = "./";
53
54 if (gSystem->Load(dir+"libmars.so")!=0)
55 {
56 cout << "\033[33m\033[1m" << "error." << endl;
57 cout << "\033[0m" << endl;
58 return false;
59 }
60 else
61 {
62 MParContainer::Class()->IgnoreTObjectStreamer();
63 MArray::Class()->IgnoreTObjectStreamer();
64 cout << "\033[33m\033[1m" << "done." << endl;
65 cout << "\033[0m" << endl;
66 return true;
67 }
68}
69/*
70void make()
71{
72 unload();
73
74 if (gSystem->Exec("make"))
75 {
76 cout << "Error calling make..." << endl;
77 return;
78 }
79
80 load();
81}
82*/
83void rootlogon()
84{
85 cout << endl;
86
87 TString dir = gSystem->Getenv("MARSSYS");
88 if (!dir.IsNull())
89 {
90 cout << "\033[34m\033[1m" << "Searching Mars in " << dir << " (MARSSYS)" << "\033[0m" << endl << endl;
91
92 if (!dir.EndsWith("/"))
93 dir += "/";
94 }
95
96 if (!load(dir))
97 return;
98
99 gInterpreter->AddIncludePath(dir+"macros");
100 gInterpreter->AddIncludePath(dir+"manalysis");
101 gInterpreter->AddIncludePath(dir+"mbase");
102 gInterpreter->AddIncludePath(dir+"mdata");
103 gInterpreter->AddIncludePath(dir+"mfileio");
104 gInterpreter->AddIncludePath(dir+"mfilter");
105 gInterpreter->AddIncludePath(dir+"mgeom");
106 gInterpreter->AddIncludePath(dir+"mgui");
107 gInterpreter->AddIncludePath(dir+"mhist");
108 gInterpreter->AddIncludePath(dir+"mhistmc");
109 gInterpreter->AddIncludePath(dir+"mimage");
110 gInterpreter->AddIncludePath(dir+"mmain");
111 gInterpreter->AddIncludePath(dir+"mmc");
112 gInterpreter->AddIncludePath(dir+"mmontecarlo");
113 gInterpreter->AddIncludePath(dir+"mranforest");
114 gInterpreter->AddIncludePath(dir+"mraw");
115 gInterpreter->AddIncludePath(dir+"mreflector");
116 gInterpreter->AddIncludePath(dir+"mtools");
117
118 if (TString("linux")==gSystem->GetBuildArch())
119 {
120 TString options = " -O -pipe -Wall -Woverloaded-virtual -fno-exceptions -fPIC ";
121
122 TString s = "cd $BuildDir ; ";
123 s += "g++ -c" + options + "-Iinclude -D_REENTRANT $IncludePath $SourceFiles ; ";
124 s += "g++ $ObjectFiles -shared -Wl,-soname,$LibName.so -O -o $SharedLib";
125 gSystem->SetMakeSharedLib(s);
126 }
127
128 cout << "\033[32m" << "Welcome to the Mars Root environment." << "\033[0m" << endl;
129 cout << endl;
130}
Note: See TracBrowser for help on using the repository browser.