diff --git a/tutorials/CMakeLists.txt b/tutorials/CMakeLists.txt index f5d4003f3ba28..63495a220ac92 100644 --- a/tutorials/CMakeLists.txt +++ b/tutorials/CMakeLists.txt @@ -427,7 +427,7 @@ set(hist-hbars-depends tutorial-tree-cernbuild) set(benchmarks-depends tutorial-hsimple tutorial-fit-fit1 tutorial-fit-myfit - tutorial-hist-h1draw + tutorial-hist-h1ReadAndDraw tutorial-hist-FirstContour tutorial-geom-na49view tutorial-tree-ntuple1 @@ -643,11 +643,11 @@ if(ROOT_pyroot_FOUND) #---Python tutorials dependencies-------------------------------------- set(pyroot-ntuple1-depends tutorial-pyroot-hsimple-py) - set(pyroot-h1draw-depends tutorial-pyroot-hsimple-py) + set(pyroot-h1ReadAndDraw-depends tutorial-pyroot-hsimple-py) set(pyroot-benchmarks-depends tutorial-pyroot-hsimple-py tutorial-pyroot-fit1-py tutorial-pyroot-na49view-py - tutorial-pyroot-h1draw-py + tutorial-pyroot-h1ReadAndDraw-py tutorial-pyroot-ntuple1-py) set(pyroot-fit1-depends tutorial-pyroot-fillrandom-py) set(pyroot-na49view-depends tutorial-pyroot-geometry-py) diff --git a/tutorials/demos.C b/tutorials/demos.C index 829d9563020de..c2b92556cd83c 100644 --- a/tutorials/demos.C +++ b/tutorials/demos.C @@ -29,7 +29,7 @@ void demos() { bar->AddButton("fillrandom", ".x hist/fillrandom.C", "Histograms with Random Numbers from a Function"); bar->AddButton("fit1", ".x fit/fit1.C", "A Simple Fitting Example"); bar->AddButton("multifit", ".x fit/multifit.C", "Fitting in Subranges of Histograms"); - bar->AddButton("h1draw", ".x hist/h1draw.C", "Drawing Options for 1D Histograms"); + bar->AddButton("h1ReadAndDraw", ".x hist/h1ReadAndDraw.C", "Drawing Options for 1D Histograms"); bar->AddButton("graph", ".x graphs/graph.C", "Example of a Simple Graph"); bar->AddButton("gerrors", ".x graphs/gerrors.C", "Example of a Graph with Error Bars"); bar->AddButton("tornado", ".x graphics/tornado.C", "Examples of 3-D PolyMarkers"); diff --git a/tutorials/hist/h1draw.C b/tutorials/hist/h1ReadAndDraw.C similarity index 86% rename from tutorials/hist/h1draw.C rename to tutorials/hist/h1ReadAndDraw.C index b8e9065e62831..1463629ac65db 100644 --- a/tutorials/hist/h1draw.C +++ b/tutorials/hist/h1ReadAndDraw.C @@ -1,7 +1,7 @@ /// \file /// \ingroup tutorial_hist /// \notebook -js -/// 1-D histogram drawing options. +/// Read a 1-D histogram from a ROOT File and draw it. /// We attach (or generate) the ROOT file in `$ROOTSYS/tutorials/hsimple.root` /// or `$PWD/hsimple.root` /// We draw one histogram in different formats. @@ -23,17 +23,15 @@ #include "TSystem.h" #include "TInterpreter.h" -void h1draw() +void h1ReadAndDraw() { - TString dir = gROOT->GetTutorialDir(); - dir.Append("/hsimple.C"); - dir.ReplaceAll("/./","/"); - if (gBenchmark->GetBench("hsimple") < 0) gInterpreter->LoadMacro(dir.Data()); - TFile *example = (TFile*)gROOT->ProcessLineFast("hsimple(1)"); - if (!example) return; + // Fetch and open the hsimple.root File + TFile *example = TFile::Open(gROOT->GetTutorialDir() + "/hsimple.root"); - example->ls(); - TH1 *hpx = (TH1*)example->Get("hpx"); + example->ls(); // Show the file contents + // Get the histogram from the ROOT File + TH1 *hpx = nullptr; // pointer to base class TH1 is enough + example->GetObject("hpx", hpx); TCanvas *c1 = new TCanvas("c1","Histogram Drawing Options",200,10,700,900); TPad *pad1 = new TPad("pad1", diff --git a/tutorials/legacy/benchmarks.C b/tutorials/legacy/benchmarks.C index c0a4e0e0c620f..acccf7ec24dd0 100644 --- a/tutorials/legacy/benchmarks.C +++ b/tutorials/legacy/benchmarks.C @@ -43,7 +43,7 @@ void benchmarks() { summary->AddText(" graphics/formula1.C"); summary->AddText(" hist/fillrandom.C"); summary->AddText(" fit/fit1.C"); - summary->AddText(" hist/h1draw.C"); + summary->AddText(" hist/h1ReadAndDraw.C"); summary->AddText(" graphs/graph.C"); summary->AddText(" graphs/gerrors.C"); summary->AddText(" graphics/tornado.C"); @@ -59,7 +59,7 @@ void benchmarks() { bexec(dir,"graphics/formula1.C"); bexec(dir,"hist/fillrandom.C"); bexec(dir,"fit/fit1.C"); - bexec(dir,"hist/h1draw.C"); + bexec(dir,"hist/h1ReadAndDraw.C"); bexec(dir,"graphs/graph.C"); bexec(dir,"graphs/gerrors.C"); bexec(dir,"graphics/tornado.C"); diff --git a/tutorials/legacy/pyroot/benchmarks.py b/tutorials/legacy/pyroot/benchmarks.py index 4593e2b53d5f0..375feed0e776f 100644 --- a/tutorials/legacy/pyroot/benchmarks.py +++ b/tutorials/legacy/pyroot/benchmarks.py @@ -15,7 +15,7 @@ ## macro files macros = [ 'framework.py', 'hsimple.py', 'hsum.py', 'formula1.py', - 'fillrandom.py','fit1.py', 'h1draw.py', 'graph.py', + 'fillrandom.py','fit1.py', 'h1ReadAndDraw.py', 'graph.py', 'gerrors.py', 'tornado.py', 'surfaces.py', 'zdemo.py', 'geometry.py', 'na49view.py', 'file.py', 'ntuple1.py', 'rootmarks.py' ] diff --git a/tutorials/pyroot/demo.py b/tutorials/pyroot/demo.py index fdd0f307cf6d8..d064231858fe3 100644 --- a/tutorials/pyroot/demo.py +++ b/tutorials/pyroot/demo.py @@ -42,7 +42,7 @@ bar.AddButton( 'fillrandom', r'TPython::Exec( "' + to_run.format('fillrandom.py') + '" );','Histograms with Random Numbers from a Function' ) bar.AddButton( 'fit1', r'TPython::Exec( "' + to_run.format('fit1.py') + '" );', 'A Simple Fitting Example' ) bar.AddButton( 'multifit', r'TPython::Exec( "' + to_run.format('multifit.py') + '" );', 'Fitting in Subranges of Histograms' ) -bar.AddButton( 'h1draw', r'TPython::Exec( "' + to_run.format('h1draw.py') + '" );', 'Drawing Options for 1D Histograms' ) +bar.AddButton( 'h1draw', r'TPython::Exec( "' + to_run.format('h1ReadAndDraw.py') + '" );', 'Drawing Options for 1D Histograms' ) bar.AddButton( 'graph', r'TPython::Exec( "' + to_run.format('graph.py') + '" );', 'Example of a Simple Graph' ) bar.AddButton( 'gerrors', r'TPython::Exec( "' + to_run.format('gerrors.py') + '" );', 'Example of a Graph with Error Bars' ) bar.AddButton( 'tornado', r'TPython::Exec( "' + to_run.format('tornado.py') + '" );', 'Examples of 3-D PolyMarkers' ) diff --git a/tutorials/pyroot/h1draw.py b/tutorials/pyroot/h1ReadAndDraw.py similarity index 100% rename from tutorials/pyroot/h1draw.py rename to tutorials/pyroot/h1ReadAndDraw.py