-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Added Histogram ROOT File Tutorial #8699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. | ||
|
|
@@ -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; | ||
| // Generate the 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", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have you renamed |
||
| 'gerrors.py', 'tornado.py', 'surfaces.py', 'zdemo.py', | ||
| 'geometry.py', 'na49view.py', 'file.py', | ||
| 'ntuple1.py', 'rootmarks.py' ] | ||
|
|
||
There was a problem hiding this comment.
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: