Changeset 8827 for trunk


Ignore:
Timestamp:
01/24/08 09:56:56 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/Changelog

    r8826 r8827  
    2626     - SetOwner of the fList
    2727
     28   * macros/rootlogon.C:
     29     - improved
    2830
    2931
  • trunk/MagicSoft/Cosy/macros/rootlogon.C

    r1690 r8827  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
     18!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2001
     20!   Copyright: MAGIC Software Development, 2000-2008
    2121!
    2222!
    2323\* ======================================================================== */
    2424
     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// If libmars.so is not found in the current directory we search in the
     44// directory given in "MARSSYS" environment variable.
     45//
     46///////////////////////////////////////////////////////////////////////////
    2547
    26 void rootlogon()
     48bool load(TString &dir)
    2749{
     50    bool rc = true;
    2851
    29     cout << endl;
     52    if (dir.IsNull())
     53        dir = "./";
    3054
    31     cout << "Loading 'cosy.so'... " << flush;
     55    cout << "\033[33m\033[1m" << "Loading '" << dir << "libmars.so'... " << "\033[0m" << flush;
    3256
    33     if (gSystem->Load("cosy.so")!=0)
    34         cout << "error." << endl;
     57    if (gSystem->Load(dir+"libmars.so")!=0)
     58    {
     59        cout << "\033[33m\033[1m" << "error." << endl;
     60        cout << "\033[0m" << endl;
     61        rc = false;
     62    }
     63    else
     64    {
     65        MParContainer::Class()->IgnoreTObjectStreamer();
     66        MArray::Class()->IgnoreTObjectStreamer();
     67        cout << "\033[33m\033[1m" << "done." << "\033[0m" << endl;
     68    }
     69
     70    cout << "\033[33m\033[1m" << "Loading '" << dir << "libcosy.so'... " << "\033[0m" << flush;
     71
     72    if (gSystem->Load(dir+"libcosy.so")!=0)
     73    {
     74        cout << "\033[33m\033[1m" << "error." << endl;
     75        cout << "\033[0m" << endl;
     76        rc = false;
     77    }
    3578    else
    3679    {
    3780        //MParContainer::Class()->IgnoreTObjectStreamer();
    3881        //MArray::Class()->IgnoreTObjectStreamer();
    39         cout << "done." << endl;
     82        cout << "\033[33m\033[1m" << "done." << endl;
     83        cout << "\033[0m" << endl;
     84    }
     85    return rc;
     86}
     87/*
     88void make()
     89{
     90    unload();
     91
     92    if (gSystem->Exec("make"))
     93    {
     94        cout << "Error calling make..." << endl;
     95        return;
    4096    }
    4197
    42     gInterpreter->AddIncludePath("base");
    43     gInterpreter->AddIncludePath("main");
    44 
     98    load();
     99}
     100*/
     101void rootlogon()
     102{
    45103    cout << endl;
    46104
    47     cout << "Welcome to the Cosy Root environment." << endl;
     105    const Bool_t fileexist = !gSystem->AccessPathName("libcosy.so", kFileExists);
    48106
     107    TString dir = fileexist ? "" : gSystem->Getenv("COSYSYS");
     108    if (!dir.IsNull())
     109    {
     110        cout << "\033[34m\033[1m" << "Searching Mars in " << dir << " (COSYSYS)" << "\033[0m" << endl << endl;
     111
     112        if (!dir.EndsWith("/"))
     113            dir += "/";
     114    }
     115
     116    if (!load(dir))
     117        return;
     118
     119    MLog::RedirectErrorHandler(MLog::kColor);
     120
     121    /*
     122    gInterpreter->AddIncludePath(dir+"macros");
     123    gInterpreter->AddIncludePath(dir+"manalysis");
     124    gInterpreter->AddIncludePath(dir+"mastro");
     125    gInterpreter->AddIncludePath(dir+"mbase");
     126    gInterpreter->AddIncludePath(dir+"mbadpixels");
     127    gInterpreter->AddIncludePath(dir+"mcamera");
     128    gInterpreter->AddIncludePath(dir+"mcalib");
     129    gInterpreter->AddIncludePath(dir+"mhcalib");
     130    gInterpreter->AddIncludePath(dir+"mdata");
     131    gInterpreter->AddIncludePath(dir+"mfbase");
     132    gInterpreter->AddIncludePath(dir+"mfileio");
     133    gInterpreter->AddIncludePath(dir+"mfilter");
     134    gInterpreter->AddIncludePath(dir+"mgeom");
     135    gInterpreter->AddIncludePath(dir+"mgui");
     136    gInterpreter->AddIncludePath(dir+"mhbase");
     137    gInterpreter->AddIncludePath(dir+"mhflux");
     138    gInterpreter->AddIncludePath(dir+"mhft");
     139    gInterpreter->AddIncludePath(dir+"mhist");
     140    gInterpreter->AddIncludePath(dir+"mhistmc");
     141    gInterpreter->AddIncludePath(dir+"mhvstime");
     142    gInterpreter->AddIncludePath(dir+"mimage");
     143    gInterpreter->AddIncludePath(dir+"mjobs");
     144    gInterpreter->AddIncludePath(dir+"mjoptim");
     145    gInterpreter->AddIncludePath(dir+"mjtrain");
     146    gInterpreter->AddIncludePath(dir+"mmain");
     147    gInterpreter->AddIncludePath(dir+"mmc");
     148    gInterpreter->AddIncludePath(dir+"mmontecarlo");
     149    gInterpreter->AddIncludePath(dir+"mmuon");
     150    gInterpreter->AddIncludePath(dir+"mpedestal");
     151    gInterpreter->AddIncludePath(dir+"mpointing");
     152    gInterpreter->AddIncludePath(dir+"mranforest");
     153    gInterpreter->AddIncludePath(dir+"mraw");
     154    gInterpreter->AddIncludePath(dir+"mreflector");
     155    gInterpreter->AddIncludePath(dir+"mreport");
     156    gInterpreter->AddIncludePath(dir+"msignal");
     157    gInterpreter->AddIncludePath(dir+"msql");
     158    gInterpreter->AddIncludePath(dir+"mstarcam");
     159    gInterpreter->AddIncludePath(dir+"mtools");
     160    gInterpreter->AddIncludePath(dir+"mtrigger");
     161    */
     162
     163    if (TString("linux")==gSystem->GetBuildArch())
     164    {
     165        TString options = " -O3 -pipe -Wall -Woverloaded-virtual -fno-exceptions -fPIC ";
     166
     167        TString s = "cd $BuildDir ; ";
     168        s += "g++ -c" + options + "-Iinclude -D_REENTRANT $IncludePath $SourceFiles ; ";
     169        s += "g++ $ObjectFiles -shared -Wl,-soname,$LibName.so -O -o $SharedLib";
     170        gSystem->SetMakeSharedLib(s);
     171    }
     172
     173    cout << "\033[32m" << "Welcome to the Cosy Root environment." << "\033[0m" << endl;
    49174    cout << endl;
    50175}
    51 
Note: See TracChangeset for help on using the changeset viewer.