ea3d333
diff --git a/hist/histpainter/src/THistPainter.cxx b/hist/histpainter/src/THistPainter.cxx
ea3d333
index 778381a..e9701c6 100644
ea3d333
--- a/hist/histpainter/src/THistPainter.cxx
ea3d333
+++ b/hist/histpainter/src/THistPainter.cxx
ea3d333
@@ -2264,8 +2264,8 @@ Begin_Macro(source)
16e38e1
    Double_t lat2 = 50;
16e38e1
    TH2Poly *p = new TH2Poly("USA","USA Population",lon1,lon2,lat1,lat2);
16e38e1
 
16e38e1
-   TFile *f;
16e38e1
-   f = TFile::Open("http://root.cern.ch/files/usa.root");
16e38e1
+   TFile::SetCacheFileDir(".");
16e38e1
+   TFile *f = TFile::Open("http://root.cern.ch/files/usa.root", "CACHEREAD");
16e38e1
 
16e38e1
    TMultiGraph *mg;
16e38e1
    TKey *key;
ea3d333
diff --git a/test/stressGraphics.cxx b/test/stressGraphics.cxx
ea3d333
index c734bf6..a95b226 100644
ea3d333
--- a/test/stressGraphics.cxx
ea3d333
+++ b/test/stressGraphics.cxx
ea3d333
@@ -1984,7 +1984,8 @@ void th2poly()
16e38e1
    Double_t lat2 = 50;
16e38e1
    TH2Poly *p = new TH2Poly("USA","USA Population",lon1,lon2,lat1,lat2);
16e38e1
 
16e38e1
-   TFile *f = TFile::Open("http://root.cern.ch/files/usa.root");
16e38e1
+   TFile::SetCacheFileDir(".");
16e38e1
+   TFile *f = TFile::Open("http://root.cern.ch/files/usa.root", "CACHEREAD");
16e38e1
 
16e38e1
    if (!f) {
16e38e1
       printf("Cannot access usa.root. Is internet working ?\n");
ea3d333
diff --git a/test/stressHistogram.cxx b/test/stressHistogram.cxx
ea3d333
index 25f2c59..f6a3c67 100644
ea3d333
--- a/test/stressHistogram.cxx
ea3d333
+++ b/test/stressHistogram.cxx
ea3d333
@@ -10167,7 +10167,8 @@ int stressHistogram()
16e38e1
       refFile = TFile::Open(refFileName, "RECREATE");
16e38e1
    }
16e38e1
    else {
16e38e1
-      refFile = TFile::Open(refFileName);
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      refFile = TFile::Open(refFileName, "CACHEREAD");
16e38e1
    }
16e38e1
 
16e38e1
    if ( refFile != 0 ) {
ea3d333
diff --git a/test/stressRooFit.cxx b/test/stressRooFit.cxx
ea3d333
index 8256069..fe2a3e1 100644
ea3d333
--- a/test/stressRooFit.cxx
ea3d333
+++ b/test/stressRooFit.cxx
ea3d333
@@ -78,10 +78,11 @@ Int_t stressRooFit(const char* refFile, Bool_t writeRef, Int_t doVerbose, Int_t
16e38e1
          cout << "stressRooFit ERROR: reference file must be local file in writing mode" << endl ;
16e38e1
          return 1;
16e38e1
       }
16e38e1
-      fref = new TWebFile(refFile) ;
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      fref = TFile::Open(refFile,"CACHEREAD") ;
ea3d333
       //std::cout << "using WEB file " << refFile << std::endl;
16e38e1
     } else {
16e38e1
-      fref = new TFile(refFile,writeRef?"RECREATE":"") ;
16e38e1
+      fref = TFile::Open(refFile,writeRef?"RECREATE":"") ;
ea3d333
       //std::cout << "using file " << refFile << std::endl;
16e38e1
     }
16e38e1
     if (fref->IsZombie()) {
ea3d333
diff --git a/test/stressTMVA.cxx b/test/stressTMVA.cxx
ea3d333
index 23f522c..128024a 100644
ea3d333
--- a/test/stressTMVA.cxx
ea3d333
+++ b/test/stressTMVA.cxx
ea3d333
@@ -2020,21 +2020,15 @@ void MethodUnitTestWithROCLimits::run()
ea3d333
   dataloader->AddVariable( _VariableNames->at(3),                "Variable 4", "units", 'F' );
16e38e1
 
16e38e1
   TFile* input(0);
16e38e1
-
16e38e1
   FileStat_t stat;
16e38e1
 
16e38e1
-  TString fname = "../tmva/test/data/toy_sigbkg.root"; //tmva_example.root";
16e38e1
-  const char *fcname = gSystem->ExpandPathName("$ROOTSYS/tmva/test/data/toy_sigbkg.root");
16e38e1
+  TString fname = "./tmva_class_example.root";
16e38e1
   if(!gSystem->GetPathInfo(fname,stat)) {
16e38e1
      input = TFile::Open( fname );
16e38e1
-  } else if(!gSystem->GetPathInfo("../"+fname,stat)) {
16e38e1
-     input = TFile::Open( "../"+fname );
16e38e1
-  } else if(fcname && !gSystem->GetPathInfo(fcname,stat)) {
16e38e1
-     input = TFile::Open( fcname );
16e38e1
   } else {
16e38e1
-     input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" );
16e38e1
+     TFile::SetCacheFileDir(".");
16e38e1
+     input = TFile::Open("http://root.cern.ch/files/tmva_class_example.root", "CACHEREAD");
16e38e1
   }
16e38e1
-  delete [] fcname;
16e38e1
   if (input == NULL) {
16e38e1
      cerr << "broken/inaccessible input file" << endl;
16e38e1
   }
ea3d333
@@ -2451,14 +2445,12 @@ void RegressionUnitTestWithDeviation::run()
16e38e1
    TFile* input(0);
16e38e1
    FileStat_t stat;
16e38e1
 
16e38e1
-   // FIXME:: give the filename of the sample somewhere else?
16e38e1
-   TString fname = "../tmva/test/tmva_reg_example.root";
16e38e1
+   TString fname = "./tmva_reg_example.root";
16e38e1
    if(!gSystem->GetPathInfo(fname,stat)) {
16e38e1
       input = TFile::Open( fname );
16e38e1
-   } else if(!gSystem->GetPathInfo("../"+fname,stat)) {
16e38e1
-      input = TFile::Open( "../"+fname );
16e38e1
    } else {
16e38e1
-      input = TFile::Open( "http://root.cern.ch/files/tmva_reg_example.root" );
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      input = TFile::Open("http://root.cern.ch/files/tmva_reg_example.root", "CACHEREAD");
16e38e1
    }
16e38e1
    if (input == NULL) {
16e38e1
       cerr << "broken/inaccessible input file" << endl;
ea3d333
diff --git a/tmva/pymva/test/Classification.C b/tmva/pymva/test/Classification.C
ea3d333
index 71987a7..d5c8c6e 100644
ea3d333
--- a/tmva/pymva/test/Classification.C
ea3d333
+++ b/tmva/pymva/test/Classification.C
ea3d333
@@ -27,23 +27,26 @@ void Classification()
16e38e1
    TMVA::Factory *factory = new TMVA::Factory("TMVAClassification", outputFile,
16e38e1
          "!V:!Silent:Color:DrawProgressBar:Transformations=I;D;P;G,D:AnalysisType=Classification");
16e38e1
 
16e38e1
-
16e38e1
    factory->AddVariable("myvar1 := var1+var2", 'F');
16e38e1
    factory->AddVariable("myvar2 := var1-var2", "Expression 2", "", 'F');
16e38e1
    factory->AddVariable("var3",                "Variable 3", "units", 'F');
16e38e1
    factory->AddVariable("var4",                "Variable 4", "units", 'F');
16e38e1
-
16e38e1
-
16e38e1
    factory->AddSpectator("spec1 := var1*2",  "Spectator 1", "units", 'F');
16e38e1
    factory->AddSpectator("spec2 := var1*3",  "Spectator 2", "units", 'F');
16e38e1
 
16e38e1
-
16e38e1
+   TFile *input(0);
16e38e1
    TString fname = "./tmva_class_example.root";
16e38e1
-
16e38e1
-   if (gSystem->AccessPathName(fname))    // file does not exist in local directory
16e38e1
-      gSystem->Exec("curl -O http://root.cern.ch/files/tmva_class_example.root");
16e38e1
-
16e38e1
-   TFile *input = TFile::Open(fname);
16e38e1
+   if (!gSystem->AccessPathName( fname )) {
16e38e1
+      input = TFile::Open( fname ); // check if file in local directory exists
16e38e1
+   }
16e38e1
+   else {
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      input = TFile::Open("http://root.cern.ch/files/tmva_class_example.root", "CACHEREAD");
16e38e1
+   }
16e38e1
+   if (!input) {
16e38e1
+      std::cout << "ERROR: could not open data file" << std::endl;
16e38e1
+      exit(1);
16e38e1
+   }
16e38e1
 
16e38e1
    std::cout << "--- TMVAClassification       : Using input file: " << input->GetName() << std::endl;
16e38e1
 
ea3d333
diff --git a/tmva/rmva/test/Classification.C b/tmva/rmva/test/Classification.C
ea3d333
index 5a2668f..fba8505 100644
ea3d333
--- a/tmva/rmva/test/Classification.C
ea3d333
+++ b/tmva/rmva/test/Classification.C
ea3d333
@@ -36,12 +36,19 @@ void Classification()
16e38e1
    factory->AddSpectator("spec1 := var1*2",  "Spectator 1", "units", 'F');
16e38e1
    factory->AddSpectator("spec2 := var1*3",  "Spectator 2", "units", 'F');
16e38e1
 
16e38e1
+   TFile *input(0);
16e38e1
    TString fname = "./tmva_class_example.root";
16e38e1
-
16e38e1
-   if (gSystem->AccessPathName(fname))    // file does not exist in local directory
16e38e1
-      gSystem->Exec("curl -O http://root.cern.ch/files/tmva_class_example.root");
16e38e1
-
16e38e1
-   TFile *input = TFile::Open(fname);
16e38e1
+   if (!gSystem->AccessPathName( fname )) {
16e38e1
+      input = TFile::Open( fname ); // check if file in local directory exists
16e38e1
+   }
16e38e1
+   else {
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      input = TFile::Open("http://root.cern.ch/files/tmva_class_example.root", "CACHEREAD");
16e38e1
+   }
16e38e1
+   if (!input) {
16e38e1
+      std::cout << "ERROR: could not open data file" << std::endl;
16e38e1
+      exit(1);
16e38e1
+   }
16e38e1
 
16e38e1
    std::cout << "--- TMVAClassification       : Using input file: " << input->GetName() << std::endl;
16e38e1
 
ea3d333
diff --git a/tutorials/hist/th2polyUSA.C b/tutorials/hist/th2polyUSA.C
ea3d333
index 5dc69fe..f7adef0 100644
ea3d333
--- a/tutorials/hist/th2polyUSA.C
ea3d333
+++ b/tutorials/hist/th2polyUSA.C
ea3d333
@@ -49,8 +49,8 @@ void th2polyUSA()
16e38e1
    Double_t lat2 = 50;
16e38e1
    TH2Poly *p = new TH2Poly("USA","USA Population",lon1,lon2,lat1,lat2);
16e38e1
 
16e38e1
-   TFile *f;
16e38e1
-   f = TFile::Open("http://root.cern.ch/files/usa.root");
16e38e1
+   TFile::SetCacheFileDir(".");
16e38e1
+   TFile *f = TFile::Open("http://root.cern.ch/files/usa.root", "CACHEREAD");
16e38e1
 
16e38e1
    if (!f) {
16e38e1
       printf("Cannot access usa.root. Is internet working ?\n");
ea3d333
diff --git a/tutorials/tmva/TMVAClassification.C b/tutorials/tmva/TMVAClassification.C
ea3d333
index ee2056f..1602cab 100644
ea3d333
--- a/tutorials/tmva/TMVAClassification.C
ea3d333
+++ b/tutorials/tmva/TMVAClassification.C
ea3d333
@@ -164,13 +164,19 @@ int TMVAClassification( TString myMethodList = "" )
ea3d333
 
ea3d333
    // Read training and test data
ea3d333
    // (it is also possible to use ASCII format as input -> see TMVA Users Guide)
ea3d333
+   TFile *input(0);
ea3d333
    TString fname = "./tmva_class_example.root";
ea3d333
-
ea3d333
-   if (gSystem->AccessPathName( fname ))  // file does not exist in local directory
ea3d333
-      gSystem->Exec("curl -O http://root.cern.ch/files/tmva_class_example.root");
ea3d333
-
ea3d333
-   TFile *input = TFile::Open( fname );
ea3d333
-
ea3d333
+   if (!gSystem->AccessPathName( fname )) {
ea3d333
+      input = TFile::Open( fname ); // check if file in local directory exists
ea3d333
+   }
ea3d333
+   else {
ea3d333
+      TFile::SetCacheFileDir(".");
ea3d333
+      input = TFile::Open("http://root.cern.ch/files/tmva_class_example.root", "CACHEREAD");
ea3d333
+   }
ea3d333
+   if (!input) {
ea3d333
+      std::cout << "ERROR: could not open data file" << std::endl;
ea3d333
+      exit(1);
ea3d333
+   }
ea3d333
    std::cout << "--- TMVAClassification       : Using input file: " << input->GetName() << std::endl;
ea3d333
 
ea3d333
    // Register the training and test trees
ea3d333
diff --git a/tutorials/tmva/TMVAClassificationApplication.C b/tutorials/tmva/TMVAClassificationApplication.C
ea3d333
index 255e187..b03b472 100644
ea3d333
--- a/tutorials/tmva/TMVAClassificationApplication.C
ea3d333
+++ b/tutorials/tmva/TMVAClassificationApplication.C
ea3d333
@@ -232,12 +232,14 @@ void TMVAClassificationApplication( TString myMethodList = "" )
16e38e1
    // we'll later on use only the "signal" events for the test in this example.
ea3d333
    //
16e38e1
    TFile *input(0);
ea3d333
-   TString fname = "./tmva_example.root";
ea3d333
-   if (!gSystem->AccessPathName( fname ))
16e38e1
+   TString fname = "./tmva_class_example.root";
16e38e1
+   if (!gSystem->AccessPathName( fname )) {
16e38e1
       input = TFile::Open( fname ); // check if file in local directory exists
ea3d333
-   else
16e38e1
-      input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" ); // if not: download from ROOT server
ea3d333
-
16e38e1
+   }
16e38e1
+   else {
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      input = TFile::Open("http://root.cern.ch/files/tmva_class_example.root", "CACHEREAD"); // if not: download from ROOT server
16e38e1
+   }
16e38e1
    if (!input) {
16e38e1
       std::cout << "ERROR: could not open data file" << std::endl;
16e38e1
       exit(1);
ea3d333
diff --git a/tutorials/tmva/TMVACrossValidation.C b/tutorials/tmva/TMVACrossValidation.C
ea3d333
index 1b85b98..b46004e 100644
ea3d333
--- a/tutorials/tmva/TMVACrossValidation.C
ea3d333
+++ b/tutorials/tmva/TMVACrossValidation.C
ea3d333
@@ -26,10 +26,19 @@ void TMVACrossValidation()
ea3d333
    TMVA::Tools::Instance();
16e38e1
 
ea3d333
    // Load data
16e38e1
+   TFile *input(0);
16e38e1
    TString fname = "./tmva_class_example.root";
ea3d333
-   if (gSystem->AccessPathName(fname))
16e38e1
-      gSystem->Exec("curl -O http://root.cern.ch/files/tmva_class_example.root");
ea3d333
-   TFile *input = TFile::Open(fname);
16e38e1
+   if (!gSystem->AccessPathName( fname )) {
16e38e1
+      input = TFile::Open( fname ); // check if file in local directory exists
16e38e1
+   }
16e38e1
+   else {
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      input = TFile::Open("http://root.cern.ch/files/tmva_class_example.root", "CACHEREAD");
16e38e1
+   }
16e38e1
+   if (!input) {
16e38e1
+      std::cout << "ERROR: could not open data file" << std::endl;
16e38e1
+      exit(1);
16e38e1
+   }
ea3d333
 
ea3d333
    TTree* signalTree = (TTree*)input->Get("TreeS");
ea3d333
    TTree* background = (TTree*)input->Get("TreeB");
ea3d333
diff --git a/tutorials/tmva/TMVARegression.C b/tutorials/tmva/TMVARegression.C
ea3d333
index 850ff84..c94ce13 100644
ea3d333
--- a/tutorials/tmva/TMVARegression.C
ea3d333
+++ b/tutorials/tmva/TMVARegression.C
ea3d333
@@ -166,11 +166,13 @@ void TMVARegression( TString myMethodList = "" )
ea3d333
    // load the signal and background event samples from ROOT trees
16e38e1
    TFile *input(0);
16e38e1
    TString fname = "./tmva_reg_example.root";
ea3d333
-   if (!gSystem->AccessPathName( fname ))
ea3d333
+   if (!gSystem->AccessPathName( fname )) {
16e38e1
       input = TFile::Open( fname ); // check if file in local directory exists
ea3d333
-   else
16e38e1
-      input = TFile::Open( "http://root.cern.ch/files/tmva_reg_example.root" ); // if not: download from ROOT server
ea3d333
-
ea3d333
+   }
16e38e1
+   else {
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      input = TFile::Open("http://root.cern.ch/files/tmva_reg_example.root", "CACHEREAD"); // if not: download from ROOT server
16e38e1
+   }
16e38e1
    if (!input) {
16e38e1
       std::cout << "ERROR: could not open data file" << std::endl;
16e38e1
       exit(1);
ea3d333
diff --git a/tutorials/tmva/TMVARegressionApplication.C b/tutorials/tmva/TMVARegressionApplication.C
ea3d333
index 9ceefdf..8a8e62f 100644
ea3d333
--- a/tutorials/tmva/TMVARegressionApplication.C
ea3d333
+++ b/tutorials/tmva/TMVARegressionApplication.C
ea3d333
@@ -128,16 +128,16 @@ void TMVARegressionApplication( TString myMethodList = "" )
ea3d333
    // Prepare input tree (this must be replaced by your data source)
ea3d333
    // in this example, there is a toy tree with signal and one with background events
ea3d333
    // we'll later on use only the "signal" events for the test in this example.
ea3d333
-   //   
ea3d333
+   //
16e38e1
    TFile *input(0);
16e38e1
    TString fname = "./tmva_reg_example.root";
ea3d333
    if (!gSystem->AccessPathName( fname )) {
16e38e1
       input = TFile::Open( fname ); // check if file in local directory exists
ea3d333
-   } 
ea3d333
-   else { 
16e38e1
-      input = TFile::Open( "http://root.cern.ch/files/tmva_reg_example.root" ); // if not: download from ROOT server
ea3d333
    }
16e38e1
-   
16e38e1
+   else {
16e38e1
+      TFile::SetCacheFileDir(".");
16e38e1
+      input = TFile::Open("http://root.cern.ch/files/tmva_reg_example.root", "CACHEREAD"); // if not: download from ROOT server
16e38e1
+   }
16e38e1
    if (!input) {
16e38e1
       std::cout << "ERROR: could not open data file" << std::endl;
16e38e1
       exit(1);