Re: Example .rootrc file for Windows NT

Nick van Eijndhoven (Nick@fys.ruu.nl)
Fri, 17 Oct 1997 09:59:00 +0200 (MET DST)


*** Gordon Watts wrote :
>
> Hi,
> Due to previously mentioned problems with loading DLLs from weird places,
> I had to resort to modifying my root.dynamicpath entry in the .rootrc file.
> The only example I could find was located in the tutorials section. I think
> the sample Windows NT entries in the .rootrc file are incorrect (at least,
> they didn't work for me).
>
> 1) The seperator is a ":" for file lists. Besides the fact that a ":" is a
> valid character in a NT filename, the path resolution is done by the
> routine _searchenv, which uses a ";" as the seperator (see documentation).
> So all the ":"s in there should be changed to a ";".
>
> 2) The macro expansion in the example .rootrc file are all things like
> "$ROOTSYS/bin" or something. Reading the Env class (BASE_Env.cxx) it seems
> like the required syntax is "$(ROOTSYS)/bin" for expansion. Indeed, this
> seems to work. I would guess that the UNIX lines in this example were wrong
> for the same reason.
>
> 3) I couldn't tell... is the "~/rootlib" file syntax (the ~ part, your home
> directory) recognized on windows? I would guess not, but perhaps
> translation happens someplace I didn't see. The ~ syntax is also used in
> this example file. I replaced the "~" with $(HOME) and things seemed to
> work just fine.
>
> BTW, the distrubution I used was the windows nt (w/out source code). It may
> well be that a default unix distribution comes with a different .rootrc
> file in the tutorial section?
>
> Cheers,
> Gordon.
>
> p.s. Windows NT 4.0, Service Pack 4.
>
>
>
Hi Gordon,
Indeed some given examples are wrong for windows and also the Macro
Path is not searched for rootlogon etc... in ROOT 1.03/04.
However, Fons told me to fix it in the next version.
Below follow the .rootrc & co. I use under win95 which work
Note : they should be located in your %HOME% directory, which
in my case is c:\nick.
In the next ROOT version it should be possible to replace c:\nick
by %HOME%.

Cheers,
Nick.

*----------------------------------------------------------------------*
Dr. Nick van Eijndhoven Department of Subatomic Physics
email : nick@fys.ruu.nl Utrecht University / NIKHEF
tel. +31-30-2532331 (direct) P.O. Box 80.000
tel. +31-30-2531492 (secr.) NL-3508 TA Utrecht
fax. +31-30-2518689 The Netherlands
WWW : http://www.fys.ruu.nl/~nick Office : Ornstein lab. 172
----------------------------------------------------------------------
tel. +41-22-7679751 (direct) CERN PPE Division / ALICE exp.
tel. +41-22-7675857 (secr.) CH-1211 Geneva 23
fax. +41-22-7679480 Switzerland
CERN beep : 13+7294 Office : B 160 1-012
*----------------------------------------------------------------------*

#################################################################
# Global .rootrc for ROOT sessions/jobs.
# More specific functionality can be obtained by providing a
# customized file ".rootrc" in the working directory.
#
# --- NvE 09-oct-1997 UU-SAP Utrecht
#################################################################

### Set search paths
WinNT.*.Root.DynamicPath: .;c:\nick\libs\root;%ROOTSYS%\lib
WinNT.*.Root.MacroPath: .;c:\nick

### Identify logon etc... files
Rint.Load: c:\nick\rootalias.cc
Rint.Logon: c:\nick\rootlogon.cc
Rint.Logoff: c:\nick\rootlogoff.cc

### (De)Activate memory statistics
Rint.Root.MemStat: 0

///////////////////////////////////////////////////////////////////////////
// General ROOT logon facility.
// More specific logon functionality can be obtained by providing a
// customized file "rootlogon.cc" in the working directory.
//
// --- NvE 09-oct-1997 UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////

void rootlogon()
{
#include <iostream.h>

TDatime start;

int idate=start.GetDate();
int itime=start.GetTime();

int year=idate/10000;
int month=(idate%10000)/100;
int day=idate%100;
int hh=itime/10000;
int mm=(itime%10000)/100;
int ss=itime%100;

char* c[12]={"jan","feb","mar","apr","may","jun",
"jul","aug","sep","oct","nov","dec"}

cout << endl;
cout << endl;
cout << " --- Welcome to the ROOT general session --- " << endl;
cout << endl;
cout << " --- Tree and RALICE classes are loaded by default --- " << endl;
cout << endl;
cout << " *** Start at Date : " << day << "-" << c[month-1] << "-" << year
<< " Time : " << hh << ":" << mm << ":" << ss << " ***" << endl;
cout << endl;

// Make the Tree facilities available
gSystem->Load("Root_Tree.dll");

// Make the RALICE facilities available
gSystem->Load("ralice.dll");

// Default white background for all plots
gStyle->SetCanvasColor(10);
gStyle->SetStatColor(10);
gStyle->SetTitleColor(10);
gStyle->SetPadColor(10);

// Settings for statistics information
gStyle->SetOptFit(1);
gStyle->SetOptStat(1);
}

///////////////////////////////////////////////////////////////////////////
// General ROOT logoff facility.
// More specific logoff functionality can be obtained by providing a
// customized file "rootlogoff.cc" in the working directory.
//
// --- NvE 09-oct-1997 UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////

void rootlogoff()
{
TDatime stop;

int idate=stop.GetDate();
int itime=stop.GetTime();

int year=idate/10000;
int month=(idate%10000)/100;
int day=idate%100;
int hh=itime/10000;
int mm=(itime%10000)/100;
int ss=itime%100;

char* c[12]={"jan","feb","mar","apr","may","jun",
"jul","aug","sep","oct","nov","dec"}

cout << endl;
cout << endl;
cout << " --- General ROOT session ended --- " << endl;
cout << endl;
cout << " *** Stop at Date : " << day << "-" << c[month-1] << "-" << year
<< " Time : " << hh << ":" << mm << ":" << ss << " ***" << endl;
cout << endl;
}

///////////////////////////////////////////////////////////////////////////
// File to load various global aliases and utilities at ROOT startup
// This file is loaded by .rootrc
// --- NvE 27-mar-1997 UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////

// The chi-distribution facility
void chi(TH1* histo)
{
//*** Plot the chi=val/err distribution of a certain histo ***

// Obtain number of bins
int nbx=histo->GetNbinsX();

TH1F* chi_dist = gROOT->FindObject("chi_dist");
if (chi_dist) chi_dist->Delete();
chi_dist = new TH1F("chi_dist","Chi distribution",100,-10.,10.);

float val,err,chi;
for (int i=0; i<nbx; i++)
{
val=histo->GetBinContent(i+1);
err=histo->GetBinError(i+1);
chi=0.;
if (fabs(err) > 0) chi=val/err;
chi_dist->Fill(chi);
}

// Draw the resulting chi distribution
chi_dist->Draw();
}
///////////////////////////////////////////////////////////////////////////