Index: /trunk/Mars/cmake/root.rc.in
===================================================================
--- /trunk/Mars/cmake/root.rc.in	(revision 19242)
+++ /trunk/Mars/cmake/root.rc.in	(revision 19242)
@@ -0,0 +1,43 @@
+#############################################################################
+#                                                                           #
+# This is the name of the logon macro (executed at root startup) and the    #
+# logoff macro (executed when quiting root)                                 #
+#                                                                           #
+#############################################################################
+
+Rint.Logon:  ${PROJECT_BINARY_DIR}/rootlogon.C
+Rint.Logoff: ${PROJECT_BINARY_DIR}/rootlogoff.C
+
+#############################################################################
+#                                                                           #
+# This is used if you want to use the root documentation facility to        #
+# create the documentation of the code out of the code                      #
+#                                                                           #
+#############################################################################
+
+Root.Html.DescriptionStyle:  Doc++
+
+Root.Html.Author:            !   Author(s):
+Root.Html.Copyright:         !   Copyright
+Root.Html.Modified:          !   Modified:
+Root.Html.Description        // ----
+
+Root.Html.Root:              http://root.cern.ch/root/htmldoc/
+Root.Html.HomePage:          http://magic.astro.uni-wuerzburg.de/mars/
+Root.Html.SearchEngine:      http://magic.astro.uni-wuerzburg.de/mars/search.html
+Root.Html.ViewCVS:           http://www.astro.uni-wuerzburg.de/viewcvs/
+
+
+#############################################################################
+#                                                                           #
+# Some default changes                                                      #
+#                                                                           #
+#############################################################################
+
+#Canvas.HighLightColor:  3
+#Canvas.MoveOpaque:      0
+#Canvas.ResizeOpaque:    0
+Canvas.ShowEventStatus: Yes
+#Canvas.ShowToolBar:     Yes
+#Canvas.ShowEditor:      Yes
+#Canvas.AutoExec:        No
Index: /trunk/Mars/cmake/rootlogon.C.in
===================================================================
--- /trunk/Mars/cmake/rootlogon.C.in	(revision 19242)
+++ /trunk/Mars/cmake/rootlogon.C.in	(revision 19242)
@@ -0,0 +1,184 @@
+/* ======================================================================== *\
+!
+! *
+! * 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 <mailto:tbretz@physik.rwth-aachen.de>
+!
+!   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 <iomanip>
+
+
+Bool_t isloaded()
+{
+    TString str = gSystem->GetLibraries("libmars.so");
+
+    return !str.IsNull();
+}
+
+void unload()
+{
+    if (!isloaded())
+        return;
+
+    cout << "Unloading 'libmars.so'... " << flush;
+    if (gSystem->Unload("libmars.so"))
+        cout << "error!" << endl;
+    else
+        cout << "done." << endl << endl;
+}
+
+bool load(TString &dir)
+{
+    if (isloaded())
+        return;
+
+    cout << "\033[33m\033[1m" << "Loading '" << dir << "/libmars.so'... " << "\033[0m" << flush;
+
+    if (dir.IsNull())
+        dir = "./";
+
+    if (gSystem->Load(dir+"/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 (!load("${PROJECT_BINARY_DIR}"))
+        return;
+
+    MLog::RedirectErrorHandler(MLog::kColor);
+
+    // 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);
+
+
+    cout << "\033[32m" << "Welcome to the Mars Root environment." << "\033[0m" << endl;
+    cout << endl;
+}
