Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tutorials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tutorials/demos.C
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
18 changes: 8 additions & 10 deletions tutorials/hist/h1draw.C → tutorials/hist/h1ReadAndDraw.C
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -23,17 +23,15 @@
#include "TSystem.h"
#include "TInterpreter.h"

void h1draw()
void h1ReadAndDraw()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful changing the macro name. It is used in several places:

% git grep h1draw
documentation/doxygen/parallelNotebooks.py:    dependenciesgraph.add("pyroot/h1draw.py",["pyroot/hsimple.py"])
documentation/users-guide/Graphics.md:root[] .x tutorials/hist/h1draw.C
graf2d/gpad/src/TControlBar.cxx:   bar.AddButton("h1draw",           ".x h1draw.C",
hist/histpainter/doc/index.md:  - h1draw.C: Drawing Options for 1D Histograms.
test/stressGUI.cxx:   bar->AddButton("h1draw",    ".x hist/h1draw.C",      "Drawing Options for 1D Histograms");
tutorials/CMakeLists.txt:                       tutorial-hist-h1draw
tutorials/CMakeLists.txt:  set(pyroot-h1draw-depends tutorial-pyroot-hsimple-py)
tutorials/CMakeLists.txt:                                tutorial-pyroot-h1draw-py
tutorials/demos.C:   bar->AddButton("h1draw",     ".x hist/h1draw.C",        "Drawing Options for 1D Histograms");
tutorials/hist/h1draw.C:void h1draw()
tutorials/legacy/benchmarks.C:   summary->AddText("  hist/h1draw.C");
tutorials/legacy/benchmarks.C:   bexec(dir,"hist/h1draw.C");
tutorials/legacy/pyroot/benchmarks.py:   'fillrandom.py','fit1.py', 'h1draw.py', 'graph.py',
tutorials/pyroot/demo.py:bar.AddButton( 'h1draw',        r'TPython::Exec( "' + to_run.format('h1draw.py') + '" );',    'Drawing Options for 1D Histograms' )

{
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;
// Generate the ROOT File
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the comment should not be "generate the ROOT file" as you assume the file already exists. It is not generated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdvaitDhingra can you change the comment ?

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",
Expand Down
4 changes: 2 additions & 2 deletions tutorials/legacy/benchmarks.C
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion tutorials/legacy/pyroot/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you renamed ./tutorials/pyroot/h1draw.py ? it do not see this file renaming in that PR (I may have missed it)

'gerrors.py', 'tornado.py', 'surfaces.py', 'zdemo.py',
'geometry.py', 'na49view.py', 'file.py',
'ntuple1.py', 'rootmarks.py' ]
Expand Down
2 changes: 1 addition & 1 deletion tutorials/pyroot/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand Down
File renamed without changes.