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