From 8ae808573f69c310c2ca4f9d8a3ba35a6906d49b Mon Sep 17 00:00:00 2001
From: Axel Naumann <Axel.Naumann@cern.ch>
Date: Wed, 2 Jul 2014 14:18:08 +0200
Subject: [PATCH] Use __FILE__; GetCurrentMacroName() really returns the
 currently .x-ed macro.

---
 tutorials/benchmarks.C            | 2 +-
 tutorials/demos.C                 | 2 +-
 tutorials/eve/alice_esd.C         | 2 +-
 tutorials/eve/alice_esd_split.C   | 2 +-
 tutorials/eve/pythia_display.C    | 2 +-
 tutorials/fit/fit1.C              | 2 +-
 tutorials/fit/fitslicesy.C        | 2 +-
 tutorials/fit/myfit.C             | 2 +-
 tutorials/fitsio/FITS_tutorial1.C | 2 +-
 tutorials/fitsio/FITS_tutorial2.C | 2 +-
 tutorials/fitsio/FITS_tutorial3.C | 2 +-
 tutorials/fitsio/FITS_tutorial4.C | 2 +-
 tutorials/fitsio/FITS_tutorial5.C | 2 +-
 tutorials/fitsio/FITS_tutorial6.C | 2 +-
 tutorials/foam/foam_demo.C        | 2 +-
 tutorials/foam/foam_demopers.C    | 2 +-
 tutorials/geom/geometry.C         | 2 +-
 tutorials/graphics/earth.C        | 2 +-
 tutorials/graphs/motorcycle.C     | 2 +-
 tutorials/hist/FirstContour.C     | 2 +-
 tutorials/hist/h1draw.C           | 2 +-
 tutorials/hist/hbars.C            | 4 ++--
 tutorials/hsimple.C               | 2 +-
 tutorials/io/loopdir.C            | 2 +-
 tutorials/mc/CompareMasses.C      | 2 +-
 tutorials/splot/TestSPlot.C       | 2 +-
 tutorials/tasks.C                 | 2 +-
 tutorials/tree/basic.C            | 2 +-
 tutorials/tree/basic2.C           | 2 +-
 tutorials/tree/cernbuild.C        | 2 +-
 tutorials/tree/cernstaff.C        | 2 +-
 tutorials/tree/clonesA_Event.C    | 4 ++--
 tutorials/tree/jets.C             | 2 +-
 tutorials/tree/ntuple1.C          | 2 +-
 tutorials/tree/run_h1analysis.C   | 2 +-
 tutorials/xml/DOMParsePerson.C    | 2 +-
 tutorials/xml/DOMRecursive.C      | 2 +-
 tutorials/xml/SAXHandler.C        | 2 +-
 38 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/tutorials/benchmarks.C b/tutorials/benchmarks.C
index 9bfc8617ca5..69659cf9f58 100644
--- a/tutorials/benchmarks.C
+++ b/tutorials/benchmarks.C
@@ -17,7 +17,7 @@ void bexec(TString &dir,const char *macro)
 }
 
 void benchmarks() {
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("benchmarks.C","");
    dir.ReplaceAll("/./","/");
    bench1 = new TCanvas("bench1","Benchmarks Summary",-1000,50,200,500);
diff --git a/tutorials/demos.C b/tutorials/demos.C
index 0477eeec1e8..391bcd3c3fb 100644
--- a/tutorials/demos.C
+++ b/tutorials/demos.C
@@ -6,7 +6,7 @@
 
    //Add the tutorials directory to the macro path
    //This is necessary in case this macro is executed from another user directory
-   TString dirName = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dirName = gSystem->UnixPathName(__FILE__);
    dirName.ReplaceAll("demos.C","");
    dirName.ReplaceAll("/./","");
    const char *current = gROOT->GetMacroPath();
diff --git a/tutorials/eve/alice_esd.C b/tutorials/eve/alice_esd.C
index d06a4e43cf3..79b27189197 100644
--- a/tutorials/eve/alice_esd.C
+++ b/tutorials/eve/alice_esd.C
@@ -82,7 +82,7 @@
 
 void alice_esd()
 {
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("alice_esd.C","");
    dir.ReplaceAll("/./","/");
    gROOT->LoadMacro(dir +"MultiView.C+");
diff --git a/tutorials/eve/alice_esd_split.C b/tutorials/eve/alice_esd_split.C
index 6f6a2bc1f15..d478cbe59b6 100644
--- a/tutorials/eve/alice_esd_split.C
+++ b/tutorials/eve/alice_esd_split.C
@@ -83,7 +83,7 @@
 
 void alice_esd_split()
 {
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("alice_esd_split.C","");
    dir.ReplaceAll("/./","/");
    gROOT->LoadMacro(dir +"SplitGLView.C+");
diff --git a/tutorials/eve/pythia_display.C b/tutorials/eve/pythia_display.C
index 852db935b42..1a9362d1b44 100644
--- a/tutorials/eve/pythia_display.C
+++ b/tutorials/eve/pythia_display.C
@@ -5,7 +5,7 @@
 
 void pythia_display()
 {
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("pythia_display.C","");
    dir.ReplaceAll("/./","/");
    gROOT->LoadMacro(dir +"MultiView.C+");
diff --git a/tutorials/fit/fit1.C b/tutorials/fit/fit1.C
index 9d8ddd3ef3e..75db7a08485 100644
--- a/tutorials/fit/fit1.C
+++ b/tutorials/fit/fit1.C
@@ -28,7 +28,7 @@ void fit1() {
    // We connect the ROOT file generated in a previous tutorial
    // (see begin_html <a href="fillrandom.C.html">Filling histograms with random numbers from a function</a>) end_html
    //
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("fit1.C","");
    dir.ReplaceAll("/./","/");
    TFile *file = TFile::Open("fillrandom.root");
diff --git a/tutorials/fit/fitslicesy.C b/tutorials/fit/fitslicesy.C
index afe519838d1..a26313b143a 100644
--- a/tutorials/fit/fitslicesy.C
+++ b/tutorials/fit/fitslicesy.C
@@ -17,7 +17,7 @@ void fitslicesy() {
    gStyle->SetTitleH(0.1);
 
 // Connect the input file and get the 2-d histogram in memory
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("fitslicesy.C","../hsimple.C");
    dir.ReplaceAll("/./","/");
    if (!gInterpreter->IsLoaded(dir.Data())) gInterpreter->LoadMacro(dir.Data());
diff --git a/tutorials/fit/myfit.C b/tutorials/fit/myfit.C
index 9ff3d3a31cc..8a74682672c 100644
--- a/tutorials/fit/myfit.C
+++ b/tutorials/fit/myfit.C
@@ -17,7 +17,7 @@ Double_t fitf(Double_t *x, Double_t *par)
 }
 void myfit()
 {
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("myfit.C","../hsimple.C");
    dir.ReplaceAll("/./","/");
    if (!gInterpreter->IsLoaded(dir.Data())) gInterpreter->LoadMacro(dir.Data());
diff --git a/tutorials/fitsio/FITS_tutorial1.C b/tutorials/fitsio/FITS_tutorial1.C
index a677b27a109..d9ff3e3c191 100644
--- a/tutorials/fitsio/FITS_tutorial1.C
+++ b/tutorials/fitsio/FITS_tutorial1.C
@@ -13,7 +13,7 @@ void FITS_tutorial1()
    if (!gROOT->IsBatch()) {
       //printf("Press ENTER to start..."); getchar();
    }
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
   
    // Open primary HDU from file
    TFITSHDU *hdu = new TFITSHDU(dir+"/sample1.fits");
diff --git a/tutorials/fitsio/FITS_tutorial2.C b/tutorials/fitsio/FITS_tutorial2.C
index c16f2ca83c6..eb95a2290c7 100644
--- a/tutorials/fitsio/FITS_tutorial2.C
+++ b/tutorials/fitsio/FITS_tutorial2.C
@@ -15,7 +15,7 @@ void FITS_tutorial2()
    if (!gROOT->IsBatch()) {
       //printf("Press ENTER to start..."); getchar();
    }
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
 
    // Open primary HDU from file
    TFITSHDU *hdu = new TFITSHDU(dir+"/sample2.fits");
diff --git a/tutorials/fitsio/FITS_tutorial3.C b/tutorials/fitsio/FITS_tutorial3.C
index 34dab386d0a..38acec18a2e 100644
--- a/tutorials/fitsio/FITS_tutorial3.C
+++ b/tutorials/fitsio/FITS_tutorial3.C
@@ -15,7 +15,7 @@ void FITS_tutorial3()
    
    // Open extensions 1 to 5 from file
    //printf("Press ENTER to see a canvas with all images within the file:"); getchar();
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
   
    TCanvas *c = new TCanvas("c1", "FITS tutorial #1", 800, 700);
    c->Divide(2,3);
diff --git a/tutorials/fitsio/FITS_tutorial4.C b/tutorials/fitsio/FITS_tutorial4.C
index 63fc0419725..dc2a6ef31ee 100644
--- a/tutorials/fitsio/FITS_tutorial4.C
+++ b/tutorials/fitsio/FITS_tutorial4.C
@@ -16,7 +16,7 @@ void FITS_tutorial4()
    if (!gROOT->IsBatch()) {
       //printf("Press ENTER to start..."); getchar();
    }
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
 
    //Open the table extension number 1)
    TFITSHDU *hdu = new TFITSHDU(dir+"/sample2.fits[1][DATAMAX > 2e-15]");
diff --git a/tutorials/fitsio/FITS_tutorial5.C b/tutorials/fitsio/FITS_tutorial5.C
index 0e484d22916..b425420a949 100755
--- a/tutorials/fitsio/FITS_tutorial5.C
+++ b/tutorials/fitsio/FITS_tutorial5.C
@@ -20,7 +20,7 @@ void FITS_tutorial5()
       //printf("\n");
    }
   
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
 
    //Open the table
    TFITSHDU *hdu = new TFITSHDU(dir+"/sample4.fits[1]");
diff --git a/tutorials/fitsio/FITS_tutorial6.C b/tutorials/fitsio/FITS_tutorial6.C
index ad0294b3e13..47661de0b97 100644
--- a/tutorials/fitsio/FITS_tutorial6.C
+++ b/tutorials/fitsio/FITS_tutorial6.C
@@ -10,7 +10,7 @@ void FITS_tutorial6()
    printf("We are going to open a table from a FITS file\n");
    printf("and dump its columns.\n\n");
   
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
 
    //Open the table
    TFITSHDU *hdu = new TFITSHDU(dir+"/sample4.fits[1]");
diff --git a/tutorials/foam/foam_demo.C b/tutorials/foam/foam_demo.C
index 2ba1d83ae76..a41ff92d438 100644
--- a/tutorials/foam/foam_demo.C
+++ b/tutorials/foam/foam_demo.C
@@ -10,7 +10,7 @@
 #if defined(__CINT__) && !defined(__MAKECINT__)
 {
    std::cout << "Using ACliC to run this macro since it uses custom classes" << std::endl;
-   TString macroFileName = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString macroFileName = gSystem->UnixPathName(__FILE__);
    gSystem->CompileMacro(macroFileName, "k");
    foam_demo();
 }
diff --git a/tutorials/foam/foam_demopers.C b/tutorials/foam/foam_demopers.C
index cad3a94be62..dc695cb9abc 100644
--- a/tutorials/foam/foam_demopers.C
+++ b/tutorials/foam/foam_demopers.C
@@ -18,7 +18,7 @@ Int_t foam_demopers()
   gSystem->Load("libFoam");
    
   // need to load the foam_demo tutorial for the definition of the function
-  TString macroName = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+  TString macroName = gSystem->UnixPathName(__FILE__);
   macroName.ReplaceAll("foam_demopers.C","foam_demo.C");
   gROOT->ProcessLine(TString::Format(".L %s+",macroName.Data()));
 
diff --git a/tutorials/geom/geometry.C b/tutorials/geom/geometry.C
index b44abc7074e..b361ad4b64c 100644
--- a/tutorials/geom/geometry.C
+++ b/tutorials/geom/geometry.C
@@ -2,7 +2,7 @@
 //Author: Rene Brun
    
 void geometry() {
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("geometry.C","");
    dir.ReplaceAll("/./","/");
    gROOT->Macro(Form("%s/na49.C",dir.Data()));
diff --git a/tutorials/graphics/earth.C b/tutorials/graphics/earth.C
index 16b9b88fc69..322bf2f518d 100644
--- a/tutorials/graphics/earth.C
+++ b/tutorials/graphics/earth.C
@@ -19,7 +19,7 @@
    TH2F *hs = new TH2F("hs","Sinusoidal",180, -180, 180, 181, -90.5, 90.5);
    TH2F *hp = new TH2F("hp","Parabolic", 180, -180, 180, 181, -90.5, 90.5);
 
-   TString dat = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dat = gSystem->UnixPathName(__FILE__);
    dat.ReplaceAll("C","dat");
    dat.ReplaceAll("/./","/");
 
diff --git a/tutorials/graphs/motorcycle.C b/tutorials/graphs/motorcycle.C
index 33d9ea8de4c..52bb39349ff 100644
--- a/tutorials/graphs/motorcycle.C
+++ b/tutorials/graphs/motorcycle.C
@@ -41,7 +41,7 @@ void motorcycle()
 
 
 // data taken from R library MASS: mcycle.txt
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("motorcycle.C","");
    dir.ReplaceAll("/./","/");
 
diff --git a/tutorials/hist/FirstContour.C b/tutorials/hist/FirstContour.C
index b171031ed0e..e7ef55f604d 100644
--- a/tutorials/hist/FirstContour.C
+++ b/tutorials/hist/FirstContour.C
@@ -7,7 +7,7 @@ void FirstContour()
    //accessed and displayed into a separate canvas.
    //Author: Rene Brun
    
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("FirstContour.C","../hsimple.C");
    dir.ReplaceAll("/./","/");
    if (!gInterpreter->IsLoaded(dir.Data())) gInterpreter->LoadMacro(dir.Data());
diff --git a/tutorials/hist/h1draw.C b/tutorials/hist/h1draw.C
index 65e416f5ae2..3877042c43e 100644
--- a/tutorials/hist/h1draw.C
+++ b/tutorials/hist/h1draw.C
@@ -18,7 +18,7 @@ void h1draw()
    // We draw one histogram in different formats
    //Author: Rene Brun
    
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("h1draw.C","../hsimple.C");
    dir.ReplaceAll("/./","/");
    if (gBenchmark->GetBench("hsimple") < 0) gInterpreter->LoadMacro(dir.Data());
diff --git a/tutorials/hist/hbars.C b/tutorials/hist/hbars.C
index 386a54908cb..46077a2c218 100644
--- a/tutorials/hist/hbars.C
+++ b/tutorials/hist/hbars.C
@@ -1,9 +1,9 @@
 // Example of bar charts with 1-d histograms
 // Author: Rene Brun
 void hbars() {
-   cout << gSystem->DirName(gInterpreter->GetCurrentMacroName()) << endl;
+   cout << gSystem->DirName(__FILE__) << endl;
    // try to open first the file cernstaff.root in tutorials/tree directory
-   TString filedir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString filedir = gSystem->DirName(__FILE__);
    filedir += TString("/../tree/");
    TString filename = filedir + "cernstaff.root";
    bool fileNotFound = gSystem->AccessPathName(filename); // note opposite return code
diff --git a/tutorials/hsimple.C b/tutorials/hsimple.C
index 6ebeef1322e..a4593bf690f 100644
--- a/tutorials/hsimple.C
+++ b/tutorials/hsimple.C
@@ -25,7 +25,7 @@ TFile *hsimple(Int_t get=0)
 //  write access to this directory, otherwise the file is created in $PWD
 
    TString filename = "hsimple.root";
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("hsimple.C","");
    dir.ReplaceAll("/./","/");
    TFile *hfile = 0;
diff --git a/tutorials/io/loopdir.C b/tutorials/io/loopdir.C
index 4e75aae93ac..1f61fe4d7af 100644
--- a/tutorials/io/loopdir.C
+++ b/tutorials/io/loopdir.C
@@ -4,7 +4,7 @@ void loopdir() {
    // This script uses the file generated by tutorial hsimple.C
    //Author: Rene Brun
    
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("loopdir.C","../hsimple.C");
    dir.ReplaceAll("/./","/");
    if (!gInterpreter->IsLoaded(dir.Data())) gInterpreter->LoadMacro(dir.Data());
diff --git a/tutorials/mc/CompareMasses.C b/tutorials/mc/CompareMasses.C
index 68dd083c773..adcaf1dc4c7 100644
--- a/tutorials/mc/CompareMasses.C
+++ b/tutorials/mc/CompareMasses.C
@@ -11,7 +11,7 @@
 
 void CompareMasses()
 {
-  TString massWidthFile = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+  TString massWidthFile = gSystem->UnixPathName(__FILE__);
   massWidthFile.ReplaceAll("CompareMasses.C","mass_width_2008.mc.txt");
 
   FILE* file = fopen(massWidthFile.Data(),"r");
diff --git a/tutorials/splot/TestSPlot.C b/tutorials/splot/TestSPlot.C
index 8e287a6291d..433f732176b 100644
--- a/tutorials/splot/TestSPlot.C
+++ b/tutorials/splot/TestSPlot.C
@@ -28,7 +28,7 @@ void TestSPlot()
 //
 //Authors: Anna Kreshuk, Muriel Pivc
 
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("TestSPlot.C","");
    dir.ReplaceAll("/./","/");
    TString dataFile = Form("%sTestSPlot_toyMC.dat",dir.Data());
diff --git a/tutorials/tasks.C b/tutorials/tasks.C
index a5c5f17a705..37f7bf64736 100644
--- a/tutorials/tasks.C
+++ b/tutorials/tasks.C
@@ -11,7 +11,7 @@
 
 void tasks()
 {
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("tasks.C","");
    dir.ReplaceAll("/./","/");
    gROOT->LoadMacro(dir +"MyTasks.cxx+");
diff --git a/tutorials/tree/basic.C b/tutorials/tree/basic.C
index 6af534bbab1..6a0011e0486 100644
--- a/tutorials/tree/basic.C
+++ b/tutorials/tree/basic.C
@@ -7,7 +7,7 @@ void basic() {
 
 // read file $ROOTSYS/tutorials/tree/basic.dat
 // this file has 3 columns of float data
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("basic.C","");
    dir.ReplaceAll("/./","/");
    ifstream in;
diff --git a/tutorials/tree/basic2.C b/tutorials/tree/basic2.C
index 07da86ba16f..fe19f4036f1 100644
--- a/tutorials/tree/basic2.C
+++ b/tutorials/tree/basic2.C
@@ -3,7 +3,7 @@ void basic2() {
 //   This macro is a variant of basic.C
 //Author: Rene Brun   
 
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("basic2.C","");
    dir.ReplaceAll("/./","/");
    
diff --git a/tutorials/tree/cernbuild.C b/tutorials/tree/cernbuild.C
index ba516b69b94..7eb41fa818d 100644
--- a/tutorials/tree/cernbuild.C
+++ b/tutorials/tree/cernbuild.C
@@ -19,7 +19,7 @@ TFile *cernbuild(Int_t get=0, Int_t print=1) {
    //The input file cern.dat is a copy of the CERN staff data base
    //from 1988
    TString filename = "cernstaff.root";
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("cernbuild.C","");
    dir.ReplaceAll("/./","/");
    FILE *fp = fopen(Form("%scernstaff.dat",dir.Data()),"r");
diff --git a/tutorials/tree/cernstaff.C b/tutorials/tree/cernstaff.C
index 480133df26e..dc6e19d66c7 100644
--- a/tutorials/tree/cernstaff.C
+++ b/tutorials/tree/cernstaff.C
@@ -1,7 +1,7 @@
 // Playing with a Tree containing variables of type character
 // Author: Rene Brun
 void cernstaff () {
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
    if (gSystem->AccessPathName(dir+"/cernstaff.root")) {
       gROOT->SetMacroPath(dir);
       gROOT->ProcessLine(".x cernbuild.C");
diff --git a/tutorials/tree/clonesA_Event.C b/tutorials/tree/clonesA_Event.C
index 80df4eab4d0..dcdd2fedb94 100644
--- a/tutorials/tree/clonesA_Event.C
+++ b/tutorials/tree/clonesA_Event.C
@@ -9,10 +9,10 @@
 #ifndef CLONESA_EVENT_SECOND_RUN
 
 void clonesA_Event() {
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
    gROOT->ProcessLine(TString(".L ")+dir+"/clonesA_Event.cxx+");
 #define CLONESA_EVENT_SECOND_RUN yes
-   gROOT->ProcessLine(TString("#include \"")+gInterpreter->GetCurrentMacroName()+"\"");
+   gROOT->ProcessLine("#include \"" __FILE__ "\"");
    gROOT->ProcessLine("clonesA_Event(true)");
 }
 
diff --git a/tutorials/tree/jets.C b/tutorials/tree/jets.C
index a13172e7087..ac8df96fe45 100644
--- a/tutorials/tree/jets.C
+++ b/tutorials/tree/jets.C
@@ -92,7 +92,7 @@ void jets(Int_t nev=100, Int_t npileup=200) {
    gSystem->Load("libPhysics");
    gROOT->ProcessLine(".L $ROOTSYS/tutorials/tree/JetEvent.cxx+");
    gROOT->ProcessLine("#define JETS_SECOND_RUN yes");
-   gROOT->ProcessLine(TString("#include \"")+gInterpreter->GetCurrentMacroName()+"\" ");
+   gROOT->ProcessLine("#include \"" __FILE__ "\"");
    gROOT->ProcessLine("jets(100,200,true)");
 }
 
diff --git a/tutorials/tree/ntuple1.C b/tutorials/tree/ntuple1.C
index c0d575f3d84..eba928acd08 100644
--- a/tutorials/tree/ntuple1.C
+++ b/tutorials/tree/ntuple1.C
@@ -24,7 +24,7 @@ void ntuple1() {
    //
    // Connect ROOT histogram/ntuple demonstration file
    // generated by example $ROOTSYS/tutorials/hsimple.C.
-   TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->UnixPathName(__FILE__);
    dir.ReplaceAll("ntuple1.C","../hsimple.C");
    dir.ReplaceAll("/./","/");
    if (gBenchmark->GetBench("hsimple") < 0) gInterpreter->LoadMacro(dir.Data());
diff --git a/tutorials/tree/run_h1analysis.C b/tutorials/tree/run_h1analysis.C
index 497344d06c0..f7c4ffab3e0 100644
--- a/tutorials/tree/run_h1analysis.C
+++ b/tutorials/tree/run_h1analysis.C
@@ -32,7 +32,7 @@ void run_h1analysis(int type = 0, const char * h1dir = 0) {
    chain.Add("$H1/dstarp1b.root");
    chain.Add("$H1/dstarp2.root");
 
-   TString selectionMacro = TString(gSystem->DirName(gInterpreter->GetCurrentMacroName()) ) + "/h1analysis.C"; 
+   TString selectionMacro = TString(gSystem->DirName(__FILE__) ) + "/h1analysis.C"; 
 
    if (type == 0) 
       chain.Process(selectionMacro);
diff --git a/tutorials/xml/DOMParsePerson.C b/tutorials/xml/DOMParsePerson.C
index 8372c5b80dd..c3d03292aa8 100644
--- a/tutorials/xml/DOMParsePerson.C
+++ b/tutorials/xml/DOMParsePerson.C
@@ -227,7 +227,7 @@ void DOMParsePerson()
 {
    PersonList personlist;
    gROOT->ProcessLine(".O 0");
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
    if (personlist.ParseFile(dir+"/person.xml") == 0)
       cout << personlist << endl;
 }
diff --git a/tutorials/xml/DOMRecursive.C b/tutorials/xml/DOMRecursive.C
index 671db9b1f11..8fd472a022e 100644
--- a/tutorials/xml/DOMRecursive.C
+++ b/tutorials/xml/DOMRecursive.C
@@ -48,7 +48,7 @@ void ParseContext(TXMLNode *node)
 void DOMRecursive()
 {
   TDOMParser *domParser = new TDOMParser();
-  TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+  TString dir = gSystem->DirName(__FILE__);
   domParser->SetValidate(false); // do not validate with DTD
   domParser->ParseFile(dir+"/person.xml");
 
diff --git a/tutorials/xml/SAXHandler.C b/tutorials/xml/SAXHandler.C
index 634592ead08..3bfdc3367ce 100644
--- a/tutorials/xml/SAXHandler.C
+++ b/tutorials/xml/SAXHandler.C
@@ -97,6 +97,6 @@ void SAXHandler()
    SaxHandler *saxHandler = new SaxHandler();
 
    saxParser->ConnectToHandler("SaxHandler", saxHandler);
-   TString dir = gSystem->DirName(gInterpreter->GetCurrentMacroName());
+   TString dir = gSystem->DirName(__FILE__);
    saxParser->ParseFile(dir+"/saxexample.xml");
 }
-- 
GitLab