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 ROOT_VERSION_CODE != ROOT_VERSION(${ROOT_VERSION_MAJOR},${ROOT_VERSION_MINOR},${ROOT_VERSION_PATCH})
|
---|
47 | #error Started ROOT version does not match ROOT version linked with libmars.so
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | #if defined (R__ADD_LIBRARY_PATH) && defined (R__LOAD_LIBRARY)
|
---|
51 | R__ADD_LIBRARY_PATH(${PROJECT_BINARY_DIR}/lib)
|
---|
52 | R__LOAD_LIBRARY(libmars.so)
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | Bool_t isloaded()
|
---|
56 | {
|
---|
57 | TString str = gSystem->GetLibraries("libmars.so");
|
---|
58 |
|
---|
59 | return !str.IsNull();
|
---|
60 | }
|
---|
61 |
|
---|
62 | bool load()
|
---|
63 | {
|
---|
64 | if (isloaded())
|
---|
65 | return true;
|
---|
66 |
|
---|
67 | cout << "\033[33m\033[1m" << "Loading 'libmars.so'... " << "\033[0m" << flush;
|
---|
68 |
|
---|
69 | if (gSystem->Load("${PROJECT_BINARY_DIR}/lib/libmars.so")!=0)
|
---|
70 | {
|
---|
71 | cout << "\033[31m\033[1m" << "error!" << endl;
|
---|
72 | cout << "\033[0m" << endl;
|
---|
73 | return false;
|
---|
74 | }
|
---|
75 | else
|
---|
76 | {
|
---|
77 | MParContainer::Class()->IgnoreTObjectStreamer();
|
---|
78 | MArray::Class()->IgnoreTObjectStreamer();
|
---|
79 | cout << "\033[33m\033[1m" << "done." << endl;
|
---|
80 | cout << "\033[0m" << endl;
|
---|
81 | return true;
|
---|
82 | }
|
---|
83 | }
|
---|
84 |
|
---|
85 | void rootlogon()
|
---|
86 | {
|
---|
87 | // This is a workaround to make axis behave as they
|
---|
88 | // are UTC and not local time
|
---|
89 | // gSystem->Setenv("TZ", "UTC");
|
---|
90 |
|
---|
91 | cout << endl;
|
---|
92 |
|
---|
93 | if (gROOT->GetVersionInt()<60000 && !load())
|
---|
94 | return;
|
---|
95 |
|
---|
96 | MLog::RedirectErrorHandler(MLog::kColor);
|
---|
97 |
|
---|
98 | cout << "\033[32m" << "Welcome to the Mars Root environment." << "\033[0m" << endl;
|
---|
99 | cout << endl;
|
---|
100 |
|
---|
101 | if (gROOT->GetVersionInt()>=60000)
|
---|
102 | return;
|
---|
103 |
|
---|
104 | // This initialized the thread factory. This is needed to supress
|
---|
105 | // an error which is displayed if the thread factory is initialized
|
---|
106 | // from another than the main thread (e.g. in the constructor
|
---|
107 | // of MStatusDisplay)
|
---|
108 | TThread::Self();
|
---|
109 |
|
---|
110 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/macros");
|
---|
111 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/include");
|
---|
112 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/manalysis");
|
---|
113 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mastro");
|
---|
114 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mbase");
|
---|
115 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mbadpixels");
|
---|
116 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcamera");
|
---|
117 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcalib");
|
---|
118 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcore");
|
---|
119 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mdrs");
|
---|
120 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhcalib");
|
---|
121 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mdata");
|
---|
122 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfbase");
|
---|
123 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfileio");
|
---|
124 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfilter");
|
---|
125 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mgeom");
|
---|
126 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mgui");
|
---|
127 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhbase");
|
---|
128 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhflux");
|
---|
129 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhft");
|
---|
130 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhist");
|
---|
131 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhistmc");
|
---|
132 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhvstime");
|
---|
133 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mimage");
|
---|
134 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjobs");
|
---|
135 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjoptim");
|
---|
136 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjtrain");
|
---|
137 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmain");
|
---|
138 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmc");
|
---|
139 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmontecarlo");
|
---|
140 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmuon");
|
---|
141 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mpedestal");
|
---|
142 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mpointing");
|
---|
143 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mranforest");
|
---|
144 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mraw");
|
---|
145 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mreflector");
|
---|
146 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mreport");
|
---|
147 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msignal");
|
---|
148 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msql");
|
---|
149 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mstarcam");
|
---|
150 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mtools");
|
---|
151 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mtrigger");
|
---|
152 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/melectronics");
|
---|
153 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msim");
|
---|
154 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msimreflector");
|
---|
155 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msimcamera");
|
---|
156 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcorsika");
|
---|
157 | gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mextralgo");
|
---|
158 |
|
---|
159 | TString opt(gSystem->GetFlagsOpt());
|
---|
160 | TString dbg(gSystem->GetFlagsDebug());
|
---|
161 | TString lib(gSystem->GetLinkedLibs());
|
---|
162 |
|
---|
163 | TString add = " -O5 -std=c++0x -Wall -Winit-self -fPIC -Wpointer-arith -Wcast-align -Woverloaded-virtual";
|
---|
164 | add += " -D__MARS__";
|
---|
165 | add += " -DHAVE_ZLIB";
|
---|
166 | add += " -DPACKAGE_NAME='\""+MARS::GetPackageName()+"\"'";
|
---|
167 | add += " -DPACKAGE_VERSION='\""+MARS::GetPackageName()+"\"'";
|
---|
168 | add += " -DREVISION='\""+MARS::GetRevision()+"\"'";
|
---|
169 | add += " -I\"${PROJECT_SOURCE_DIR}\"";
|
---|
170 |
|
---|
171 | opt += add;
|
---|
172 | dbg += add;
|
---|
173 |
|
---|
174 | lib += " -lnova -lz";
|
---|
175 |
|
---|
176 | gSystem->SetLinkedLibs(lib);
|
---|
177 | gSystem->SetFlagsOpt(opt);
|
---|
178 | gSystem->SetFlagsDebug(dbg);
|
---|
179 | }
|
---|