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 <mailto:tbretz@physik.rwth-aachen.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2018
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | ///////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // rootlogon.C
|
---|
28 | // ===========
|
---|
29 | //
|
---|
30 | // This file is the startup script ("autoexec.bat") executed when root is
|
---|
31 | // started. The definition which file to start is done in ".rootrc".
|
---|
32 | // There are three files which are automatically processed by root at
|
---|
33 | // startup: A systemwide .rootrc, one in your home directory and one
|
---|
34 | // in the current directory.
|
---|
35 | // So rootlogon.C is correctly executed if your start root from your
|
---|
36 | // Mars directory.
|
---|
37 | //
|
---|
38 | // The script setupts some small environmental things and makes
|
---|
39 | // sure that the Mars shared object (libmars.so) is loaded. This shared
|
---|
40 | // object gives you access to all Mars features from within the root
|
---|
41 | // interpreter.
|
---|
42 | //
|
---|
43 | ///////////////////////////////////////////////////////////////////////////
|
---|
44 | #include <iomanip>
|
---|
45 |
|
---|
46 | #if defined(ROOT_VERSION_CODE)
|
---|
47 | #if ROOT_VERSION_CODE != ROOT_VERSION(${ROOT_VERSION_MAJOR},${ROOT_VERSION_MINOR},${ROOT_VERSION_PATCH})
|
---|
48 | #error Started ROOT version does not match ROOT version linked with libmars.so
|
---|
49 | #endif
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | #if defined (R__ADD_LIBRARY_PATH) && defined (R__LOAD_LIBRARY)
|
---|
53 | R__ADD_LIBRARY_PATH(${PROJECT_BINARY_DIR}/lib)
|
---|
54 | R__LOAD_LIBRARY(libmars.so)
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | Bool_t isloaded()
|
---|
58 | {
|
---|
59 | TString str = gSystem->GetLibraries("libmars.so");
|
---|
60 |
|
---|
61 | return !str.IsNull();
|
---|
62 | }
|
---|
63 |
|
---|
64 | bool load()
|
---|
65 | {
|
---|
66 | if (isloaded())
|
---|
67 | return true;
|
---|
68 |
|
---|
69 | cout << "\033[33m\033[1m" << "Loading 'libmars.so'... " << "\033[0m" << flush;
|
---|
70 |
|
---|
71 | if (gSystem->Load("${PROJECT_BINARY_DIR}/lib/libmars.so")!=0)
|
---|
72 | {
|
---|
73 | cout << "\033[31m\033[1m" << "error!" << endl;
|
---|
74 | cout << "\033[0m" << endl;
|
---|
75 | return false;
|
---|
76 | }
|
---|
77 | else
|
---|
78 | {
|
---|
79 | MParContainer::Class()->IgnoreTObjectStreamer();
|
---|
80 | MArray::Class()->IgnoreTObjectStreamer();
|
---|
81 | cout << "\033[33m\033[1m" << "done." << endl;
|
---|
82 | cout << "\033[0m" << endl;
|
---|
83 | return true;
|
---|
84 | }
|
---|
85 | }
|
---|
86 |
|
---|
87 | void rootlogon()
|
---|
88 | {
|
---|
89 | // This is a workaround to make axis behave as they
|
---|
90 | // are UTC and not local time
|
---|
91 | // gSystem->Setenv("TZ", "UTC");
|
---|
92 |
|
---|
93 | cout << endl;
|
---|
94 |
|
---|
95 | if (gROOT->GetVersionInt()<60000 && !load())
|
---|
96 | return;
|
---|
97 |
|
---|
98 | MLog::RedirectErrorHandler(MLog::kColor);
|
---|
99 |
|
---|
100 | cout << "\033[32m" << "Welcome to the Mars Root environment." << "\033[0m" << endl;
|
---|
101 | cout << endl;
|
---|
102 |
|
---|
103 | if (gROOT->GetVersionInt()>=60000)
|
---|
104 | return;
|
---|
105 |
|
---|
106 | // This initialized the thread factory. This is needed to supress
|
---|
107 | // an error which is displayed if the thread factory is initialized
|
---|
108 | // from another than the main thread (e.g. in the constructor
|
---|
109 | // of MStatusDisplay)
|
---|
110 | TThread::Self();
|
---|
111 |
|
---|
112 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/macros");
|
---|
113 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/include");
|
---|
114 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/manalysis");
|
---|
115 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mastro");
|
---|
116 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mbase");
|
---|
117 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mbadpixels");
|
---|
118 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcamera");
|
---|
119 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcalib");
|
---|
120 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcore");
|
---|
121 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mdrs");
|
---|
122 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhcalib");
|
---|
123 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mdata");
|
---|
124 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfbase");
|
---|
125 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfileio");
|
---|
126 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfilter");
|
---|
127 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mgeom");
|
---|
128 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mgui");
|
---|
129 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhbase");
|
---|
130 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhflux");
|
---|
131 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhft");
|
---|
132 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhist");
|
---|
133 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhistmc");
|
---|
134 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhvstime");
|
---|
135 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mimage");
|
---|
136 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjobs");
|
---|
137 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjoptim");
|
---|
138 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjtrain");
|
---|
139 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmain");
|
---|
140 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmc");
|
---|
141 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmontecarlo");
|
---|
142 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmuon");
|
---|
143 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mpedestal");
|
---|
144 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mpointing");
|
---|
145 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mranforest");
|
---|
146 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mraw");
|
---|
147 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mreflector");
|
---|
148 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mreport");
|
---|
149 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msignal");
|
---|
150 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msql");
|
---|
151 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mstarcam");
|
---|
152 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mtools");
|
---|
153 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mtrigger");
|
---|
154 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/melectronics");
|
---|
155 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msim");
|
---|
156 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msimreflector");
|
---|
157 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msimcamera");
|
---|
158 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcorsika");
|
---|
159 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mextralgo");
|
---|
160 |
|
---|
161 | TString opt(gSystem->GetFlagsOpt());
|
---|
162 | TString dbg(gSystem->GetFlagsDebug());
|
---|
163 | TString lib(gSystem->GetLinkedLibs());
|
---|
164 |
|
---|
165 | TString add = " -O5 -std=c++0x -Wall -Winit-self -fPIC -Wpointer-arith -Wcast-align -Woverloaded-virtual";
|
---|
166 | add += " -D__MARS__";
|
---|
167 | add += " -DHAVE_ZLIB";
|
---|
168 | add += " -DPACKAGE_NAME='\""+MARS::GetPackageName()+"\"'";
|
---|
169 | add += " -DPACKAGE_VERSION='\""+MARS::GetPackageName()+"\"'";
|
---|
170 | add += " -DREVISION='\""+MARS::GetRevision()+"\"'";
|
---|
171 | add += " -I\"${PROJECT_SOURCE_DIR}\"";
|
---|
172 |
|
---|
173 | opt += add;
|
---|
174 | dbg += add;
|
---|
175 |
|
---|
176 | lib += " -lnova -lz";
|
---|
177 |
|
---|
178 | gSystem->SetLinkedLibs(lib);
|
---|
179 | gSystem->SetFlagsOpt(opt);
|
---|
180 | gSystem->SetFlagsDebug(dbg);
|
---|
181 | }
|
---|