diff --git a/tutorials/tree/cernbuild.C b/tutorials/tree/cernbuild.C index fc7fd1d27a3c60634447c2ca98cac75d6d96ce37..94e5a43e94bf4f1cd49a295b4aa8b3bf81ee27a9 100644 --- a/tutorials/tree/cernbuild.C +++ b/tutorials/tree/cernbuild.C @@ -18,6 +18,7 @@ TFile *cernbuild(Int_t get=0) { //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()); dir.ReplaceAll("cernbuild.C",""); dir.ReplaceAll("/./","/"); @@ -70,7 +71,11 @@ TFile *cernbuild(Int_t get=0) { tree->Write(); fclose(fp); - if (get) return hfile; delete hfile; + if (get) { + //we come here when the script is executed outside $ROOTSYS/tutorials/tree + hfile = TFile::Open(filename); + return hfile; + } return 0; }