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

Last change on this file since 1958 was 1865, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 3.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("*/mars.so");
28
29 return !str.IsNull();
30}
31
32void unload()
33{
34 if (!isloaded())
35 return;
36
37 cout << "Unloading 'mars.so'... " << flush;
38 if (gSystem->Unload("mars.so"))
39 cout << "error." << endl;
40 else
41 cout << "done." << endl << endl;
42}
43
44void load(TString &dir)
45{
46 if (isloaded())
47 return;
48
49 cout << "Loading 'mars.so'... " << flush;
50
51 if (gSystem->Load(dir.IsNull() ? "mars.so" : dir+"lib/mars.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/*
63void 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*/
76void 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+"mmain");
102 gInterpreter->AddIncludePath(dir+"mmc");
103 gInterpreter->AddIncludePath(dir+"mmontecarlo");
104 gInterpreter->AddIncludePath(dir+"mraw");
105 gInterpreter->AddIncludePath(dir+"mtools");
106
107 if (TString("linux")==gSystem->GetBuildArch())
108 {
109 TString options = " -O -pipe -Wall -Woverloaded-virtual -fno-rtti -fno-exceptions -fPIC ";
110
111 TString s = "cd $BuildDir ; ";
112 s += "g++ -c" + options + "-Iinclude -D_REENTRANT $IncludePath $SourceFiles ; ";
113 s += "g++ $ObjectFiles -shared -Wl,-soname,$LibName.so -O -o $SharedLib";
114 gSystem->SetMakeSharedLib(s);
115 }
116
117 cout << "Welcome to the Mars Root environment." << endl;
118
119 cout << endl;
120}
Note: See TracBrowser for help on using the repository browser.