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

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