From c23902823aeb4032c547b3f80378c21c0b37f7e4 Mon Sep 17 00:00:00 2001
From: deserevi <deserevi@nptool>
Date: Sun, 9 Jan 2011 23:23:40 +0000
Subject: [PATCH] * Simplify NPToolLogon.C    + return to initial directory now
 uses the gSystem->cd() method    + change InitNPTool fucntion name for
 NPToolLogon (it was now compiling      on Mac os X)

* Update some doc files to explain logic of NPToolLogon.C

* Fix bug in ControlSimu.C
---
 INSTALL                         |  4 ++--
 Misc/rootlogon.C                |  6 +++---
 NPAnalysis/macros/ControlSimu.C |  2 +-
 NPLib/INSTALL                   |  2 +-
 NPLib/README                    |  3 ++-
 NPLib/scripts/NPToolLogon.C     | 21 +++++++++------------
 6 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/INSTALL b/INSTALL
index f712ec176..fefcce150 100644
--- a/INSTALL
+++ b/INSTALL
@@ -79,5 +79,5 @@ III) INSTALLATION
 		make
 	This step is not mandatory for the G4 simulation to work.
 	If you want to use the ROOT macros in the $NPAnalysis/macros
-        directory you should execute in a ROOT terminal the commands
-	you can find in rootlogon.C
+   directory you should execute in a ROOT terminal the rootlogon.C
+   file available in NPTool/Misc
diff --git a/Misc/rootlogon.C b/Misc/rootlogon.C
index 2241cfa35..c2591b2a9 100644
--- a/Misc/rootlogon.C
+++ b/Misc/rootlogon.C
@@ -26,9 +26,9 @@
    gROOT->ProcessLine( Form(".L %s/scripts/NPToolLogon.C+", path.Data()) );
    
    // No Init Display
-   // InitNPTool(false)
-   InitNPTool();
+   // NPToolLogon(false)
+   NPToolLogon();
    
    // With Init Display
-   //InitNPTool(true);
+   // NPToolLogon(true);
 }
diff --git a/NPAnalysis/macros/ControlSimu.C b/NPAnalysis/macros/ControlSimu.C
index f8f9cdb4b..1f0ddf442 100644
--- a/NPAnalysis/macros/ControlSimu.C
+++ b/NPAnalysis/macros/ControlSimu.C
@@ -142,7 +142,7 @@ void ControlSimu(const char * fname = "myResult")
 //   hControlPhi->Draw("same");
 
    // Display histograms
-   TCanvas *canvasxi32 = new TCanvas("canvas3", "Emitted particle properties", 300, 600);
+   TCanvas *canvas3 = new TCanvas("canvas3", "Emitted particle properties", 300, 600);
    canvas3->Divide(1,3);
    canvas3->cd(1);
    hEmittedThetaCM->SetXTitle("#Theta_{c.m.}");
diff --git a/NPLib/INSTALL b/NPLib/INSTALL
index a873f0b3b..be66cb9ea 100644
--- a/NPLib/INSTALL
+++ b/NPLib/INSTALL
@@ -49,4 +49,4 @@ following commands:
 	to each library are copied to the lib directory. If you are using 
 	a Mac OS system a symbolic link *.dylib is done with respect to 
 	each *.so library. The 'liblist' file used for linking NPS and NPA
-        is created.
+   is created.
diff --git a/NPLib/README b/NPLib/README
index 3e184ab1d..9519e85d7 100644
--- a/NPLib/README
+++ b/NPLib/README
@@ -49,7 +49,8 @@ II) lib directory
 	copied to this directory
 
 III) scripts
-	This directory contains several scripts used in the global Makefile.
+	This directory contains several scripts used in the global Makefile and 
+   for ROOT.
 
 IV) IORoot
 	This directory includes one library:
diff --git a/NPLib/scripts/NPToolLogon.C b/NPLib/scripts/NPToolLogon.C
index e87441095..97c080641 100644
--- a/NPLib/scripts/NPToolLogon.C
+++ b/NPLib/scripts/NPToolLogon.C
@@ -30,19 +30,17 @@
 #include <iostream>
 using namespace std;
 
-void InitNPTool(bool quietmode = false)
+void NPToolLogon(bool quietmode = false)
 {
    TString currentpath = gSystem->Getenv("PWD");
    TString path = gSystem->Getenv("NPLIB");
    
    // Add include path
-   if(quietmode)
-    cout << "NPTool: adding include path : " << path << "/include" << endl;
-    
+   if (quietmode) cout << "NPTool: adding include path : " << path << "/include" << endl;
    gROOT->ProcessLine(Form(".include %s/include", path.Data()));
+
    // Add shared libraries
-   if(quietmode)
-   cout << "NPTool: loading NPLib shared libraries ..." << endl;
+   if (quietmode) cout << "NPTool: loading NPLib shared libraries ..." << endl;
    TString libpath = Form("%s/lib", path.Data());
    TSystemDirectory libdir("libdir", libpath);
    TList* listfile = libdir.GetListOfFiles();
@@ -66,11 +64,10 @@ void InitNPTool(bool quietmode = false)
       }
    }
    
-   TSystemDirectory dir("dir",currentpath);
-   TList* listfile2 = dir.GetListOfFiles();
-   
-   if(quietmode)
-   cout << "NPTool: Ready" << endl;
+   // Since the libdir.GetListOfFiles() commands cds to the
+   // libidr directory, one has to return to the initial
+   // directory
+   gSystem->cd(currentpath);
    
-//   delete listfile2, listfile ;
+   if (quietmode) cout << "NPTool: Ready" << endl;
 }
-- 
GitLab