source: trunk/MagicSoft/Mars/macros/rootlogon.C@ 3187

Last change on this file since 3187 was 2772, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.9 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+"mcamera");
103 gInterpreter->AddIncludePath(dir+"mcalib");
104 gInterpreter->AddIncludePath(dir+"mdata");
105 gInterpreter->AddIncludePath(dir+"mfileio");
106 gInterpreter->AddIncludePath(dir+"mfilter");
107 gInterpreter->AddIncludePath(dir+"mgeom");
108 gInterpreter->AddIncludePath(dir+"mgui");
109 gInterpreter->AddIncludePath(dir+"mhbase");
110 gInterpreter->AddIncludePath(dir+"mhist");
111 gInterpreter->AddIncludePath(dir+"mhistmc");
112 gInterpreter->AddIncludePath(dir+"mimage");
113 gInterpreter->AddIncludePath(dir+"mmain");
114 gInterpreter->AddIncludePath(dir+"mmc");
115 gInterpreter->AddIncludePath(dir+"mmontecarlo");
116 gInterpreter->AddIncludePath(dir+"mpointing");
117 gInterpreter->AddIncludePath(dir+"mranforest");
118 gInterpreter->AddIncludePath(dir+"mraw");
119 gInterpreter->AddIncludePath(dir+"mreflector");
120 gInterpreter->AddIncludePath(dir+"mreport");
121 gInterpreter->AddIncludePath(dir+"mtools");
122
123 if (TString("linux")==gSystem->GetBuildArch())
124 {
125 TString options = " -O -pipe -Wall -Woverloaded-virtual -fno-exceptions -fPIC ";
126
127 TString s = "cd $BuildDir ; ";
128 s += "g++ -c" + options + "-Iinclude -D_REENTRANT $IncludePath $SourceFiles ; ";
129 s += "g++ $ObjectFiles -shared -Wl,-soname,$LibName.so -O -o $SharedLib";
130 gSystem->SetMakeSharedLib(s);
131 }
132
133 cout << "\033[32m" << "Welcome to the Mars Root environment." << "\033[0m" << endl;
134 cout << endl;
135}
Note: See TracBrowser for help on using the repository browser.