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 |
|
---|
25 | Bool_t isloaded()
|
---|
26 | {
|
---|
27 | TString str = gSystem->GetLibraries("libmars.so");
|
---|
28 |
|
---|
29 | return !str.IsNull();
|
---|
30 | }
|
---|
31 |
|
---|
32 | void 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 |
|
---|
44 | void load(TString &dir)
|
---|
45 | {
|
---|
46 | if (isloaded())
|
---|
47 | return;
|
---|
48 |
|
---|
49 | cout << "Loading 'libmars.so'... " << flush;
|
---|
50 |
|
---|
51 | if (gSystem->Load(dir.IsNull() ? "libmars.so" : dir+"libmars.so")!=0)
|
---|
52 | cout << "error." << endl;
|
---|
53 | else
|
---|
54 | {
|
---|
55 | MParContainer::Class()->IgnoreTObjectStreamer();
|
---|
56 | MArray::Class()->IgnoreTObjectStreamer();
|
---|
57 | cout << "done." << endl;
|
---|
58 | }
|
---|
59 |
|
---|
60 | cout << endl;
|
---|
61 | }
|
---|
62 | /*
|
---|
63 | void make()
|
---|
64 | {
|
---|
65 | unload();
|
---|
66 |
|
---|
67 | if (gSystem->Exec("make"))
|
---|
68 | {
|
---|
69 | cout << "Error calling make..." << endl;
|
---|
70 | return;
|
---|
71 | }
|
---|
72 |
|
---|
73 | load();
|
---|
74 | }
|
---|
75 | */
|
---|
76 | void rootlogon()
|
---|
77 | {
|
---|
78 | cout << endl;
|
---|
79 |
|
---|
80 | TString dir = gSystem->Getenv("MARSSYS");
|
---|
81 |
|
---|
82 | if (!dir.IsNull())
|
---|
83 | {
|
---|
84 | cout << "Mars found in " << dir << " (MARSSYS)" << endl << endl;
|
---|
85 |
|
---|
86 | if (!dir.EndsWith("/"))
|
---|
87 | dir += "/";
|
---|
88 | }
|
---|
89 |
|
---|
90 | load(dir);
|
---|
91 |
|
---|
92 | gInterpreter->AddIncludePath(dir+"macros");
|
---|
93 | gInterpreter->AddIncludePath(dir+"manalysis");
|
---|
94 | gInterpreter->AddIncludePath(dir+"mbase");
|
---|
95 | gInterpreter->AddIncludePath(dir+"mdata");
|
---|
96 | gInterpreter->AddIncludePath(dir+"mfileio");
|
---|
97 | gInterpreter->AddIncludePath(dir+"mfilter");
|
---|
98 | gInterpreter->AddIncludePath(dir+"mgeom");
|
---|
99 | gInterpreter->AddIncludePath(dir+"mgui");
|
---|
100 | gInterpreter->AddIncludePath(dir+"mhist");
|
---|
101 | gInterpreter->AddIncludePath(dir+"mhistmc");
|
---|
102 | gInterpreter->AddIncludePath(dir+"mimage");
|
---|
103 | gInterpreter->AddIncludePath(dir+"mmain");
|
---|
104 | gInterpreter->AddIncludePath(dir+"mmc");
|
---|
105 | gInterpreter->AddIncludePath(dir+"mmontecarlo");
|
---|
106 | gInterpreter->AddIncludePath(dir+"mranforest");
|
---|
107 | gInterpreter->AddIncludePath(dir+"mraw");
|
---|
108 | gInterpreter->AddIncludePath(dir+"mreflector");
|
---|
109 | gInterpreter->AddIncludePath(dir+"mtools");
|
---|
110 |
|
---|
111 | if (TString("linux")==gSystem->GetBuildArch())
|
---|
112 | {
|
---|
113 | TString options = " -O -pipe -Wall -Woverloaded-virtual -fno-exceptions -fPIC ";
|
---|
114 |
|
---|
115 | TString s = "cd $BuildDir ; ";
|
---|
116 | s += "g++ -c" + options + "-Iinclude -D_REENTRANT $IncludePath $SourceFiles ; ";
|
---|
117 | s += "g++ $ObjectFiles -shared -Wl,-soname,$LibName.so -O -o $SharedLib";
|
---|
118 | gSystem->SetMakeSharedLib(s);
|
---|
119 | }
|
---|
120 |
|
---|
121 | cout << "Welcome to the Mars Root environment." << endl;
|
---|
122 |
|
---|
123 | cout << endl;
|
---|
124 | }
|
---|