/* ======================================================================== *\ ! ! * ! * This file is part of MARS, the MAGIC Analysis and Reconstruction ! * Software. It is distributed to you in the hope that it can be a useful ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. ! * It is distributed WITHOUT ANY WARRANTY. ! * ! * Permission to use, copy, modify and distribute this software and its ! * documentation for any purpose is hereby granted without fee, ! * provided that the above copyright notice appear in all copies and ! * that both that copyright notice and this permission notice appear ! * in supporting documentation. It is provided "as is" without express ! * or implied warranty. ! * ! ! ! Author(s): Thomas Bretz, 12/2000 ! ! Copyright: MAGIC Software Development, 2000-2018 ! ! \* ======================================================================== */ /////////////////////////////////////////////////////////////////////////// // // rootlogon.C // =========== // // This file is the startup script ("autoexec.bat") executed when root is // started. The definition which file to start is done in ".rootrc". // There are three files which are automatically processed by root at // startup: A systemwide .rootrc, one in your home directory and one // in the current directory. // So rootlogon.C is correctly executed if your start root from your // Mars directory. // // The script setupts some small environmental things and makes // sure that the Mars shared object (libmars.so) is loaded. This shared // object gives you access to all Mars features from within the root // interpreter. // /////////////////////////////////////////////////////////////////////////// #include #if defined(ROOT_VERSION_CODE) #if ROOT_VERSION_CODE != ROOT_VERSION(${ROOT_VERSION_MAJOR},${ROOT_VERSION_MINOR},${ROOT_VERSION_PATCH}) #error Started ROOT version does not match ROOT version linked with libmars.so #endif #endif #if defined (R__ADD_LIBRARY_PATH) && defined (R__LOAD_LIBRARY) R__ADD_LIBRARY_PATH(${PROJECT_BINARY_DIR}/lib) R__LOAD_LIBRARY(libmars.so) #endif Bool_t isloaded() { TString str = gSystem->GetLibraries("libmars.so"); return !str.IsNull(); } bool load() { if (isloaded()) return true; cout << "\033[33m\033[1m" << "Loading 'libmars.so'... " << "\033[0m" << flush; if (gSystem->Load("${PROJECT_BINARY_DIR}/lib/libmars.so")!=0) { cout << "\033[31m\033[1m" << "error!" << endl; cout << "\033[0m" << endl; return false; } else { MParContainer::Class()->IgnoreTObjectStreamer(); MArray::Class()->IgnoreTObjectStreamer(); cout << "\033[33m\033[1m" << "done." << endl; cout << "\033[0m" << endl; return true; } } void rootlogon() { // This is a workaround to make axis behave as they // are UTC and not local time // gSystem->Setenv("TZ", "UTC"); cout << endl; if (gROOT->GetVersionInt()<60000 && !load()) return; MLog::RedirectErrorHandler(MLog::kColor); cout << "\033[32m" << "Welcome to the Mars Root environment." << "\033[0m" << endl; cout << endl; if (gROOT->GetVersionInt()>=60000) return; // This initialized the thread factory. This is needed to supress // an error which is displayed if the thread factory is initialized // from another than the main thread (e.g. in the constructor // of MStatusDisplay) TThread::Self(); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/macros"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/include"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/manalysis"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mastro"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mbase"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mbadpixels"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcamera"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcalib"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcore"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mdrs"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhcalib"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mdata"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfbase"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfileio"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mfilter"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mgeom"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mgui"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhbase"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhflux"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhft"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhist"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhistmc"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mhvstime"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mimage"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjobs"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjoptim"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mjtrain"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmain"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmc"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmontecarlo"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mmuon"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mpedestal"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mpointing"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mranforest"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mraw"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mreflector"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mreport"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msignal"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msql"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mstarcam"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mtools"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mtrigger"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/melectronics"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msim"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msimreflector"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/msimcamera"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mcorsika"); gInterpreter->AddIncludePath("${PROJECT_SOURCE_DIR}/mextralgo"); TString opt(gSystem->GetFlagsOpt()); TString dbg(gSystem->GetFlagsDebug()); TString lib(gSystem->GetLinkedLibs()); TString add = " -O5 -std=c++0x -Wall -Winit-self -fPIC -Wpointer-arith -Wcast-align -Woverloaded-virtual"; add += " -D__MARS__"; add += " -DHAVE_ZLIB"; add += " -DPACKAGE_NAME='\""+MARS::GetPackageName()+"\"'"; add += " -DPACKAGE_VERSION='\""+MARS::GetPackageName()+"\"'"; add += " -DREVISION='\""+MARS::GetRevision()+"\"'"; add += " -I\"${PROJECT_SOURCE_DIR}\""; opt += add; dbg += add; lib += " -lnova -lz"; gSystem->SetLinkedLibs(lib); gSystem->SetFlagsOpt(opt); gSystem->SetFlagsDebug(dbg); }