-
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
Conversation
|
Starting build on |
tutorials/hist/ReadROOTFile.C
Outdated
|
|
||
| void ReadROOTFile() | ||
| { | ||
| TFile *f = new TFile("demo.root"); |
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.
"hsimple.root" should always exist
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.
Please use a combination of gROOT->GetTutorialsDir() and hsimple.root - which does exist - instead of demo.root - which doesn't exist. You will have to use one of the histograms from hsimple.root then, of course.
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.
The macro https://root.cern/doc/master/h1draw_8C.html does something similar to what you are doing. It creates the file hsimple.root if it does not exist, get the histograms in it and draw them.
|
Build failed on ROOT-debian10-i386/cxx14. Failing tests: |
|
Starting build on |
1 similar comment
|
Starting build on |
|
Build failed on ROOT-performance-centos8-multicore/default. Failing tests: |
|
Build failed on ROOT-debian10-i386/cxx14. Failing tests: |
tutorials/hist/ReadROOTFile.C
Outdated
|
|
||
| void ReadROOTFile() | ||
| { | ||
| TFile *f = new TFile("demo.root"); |
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.
Please use a combination of gROOT->GetTutorialsDir() and hsimple.root - which does exist - instead of demo.root - which doesn't exist. You will have to use one of the histograms from hsimple.root then, of course.
tutorials/hist/CreateROOTFile.C
Outdated
| @@ -0,0 +1,31 @@ | |||
| /// \file | |||
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.
As we discussed, please remove CreateROOTFile.C but instead rely on hsimple.root which gets created during build time.
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.
Done
|
Starting build on |
|
Starting build on |
|
👉 View analysis in DeepCode’s Dashboard | Configure the bot👉 The DeepCode service and API will be deprecated in August, 2021. Here is the information how to migrate. Thank you for using DeepCode 🙏 ❤️ !If you are using our plugins, you might be interested in their successors: Snyk's JetBrains plugin and Snyk's VS Code plugin. |
|
Build failed on ROOT-performance-centos8-multicore/default. Failing tests: |
|
Build failed on ROOT-debian10-i386/cxx14. Errors:
Failing tests: |
|
I think the problem is that hsimple.root doesnt exist without hsimple.C being run first. I aborted the jenkins. |
|
It gets created as part of the build: it does exist, in the |
Ahh, ok |
|
Starting build on |
|
Starting build on |
|
@Axel-Naumann, @couet pointed out that my read file was basically a simpler version of h1draw.C and that it would be better to just clarify some things in that file. |
|
Starting build on |
|
Build failed on ROOT-performance-centos8-multicore/default. Errors:
Failing tests: |
|
Build failed on ROOT-debian10-i386/cxx14. Errors:
Failing tests: |
|
Build failed on mac11.0/cxx17. Errors:
Failing tests: |
|
Starting build on |
|
That was a pretty funny mistake 😆 |
|
Build failed on ROOT-debian10-i386/cxx14. Failing tests: |
|
The filename is referred to here: |
|
Starting build on |
I clarified some things. Modified tutorial Removed my file and modified h1draw.C Minor changes Fixed mistake Simplified
|
Starting build on |
|
Starting build on |
|
Build failed on ROOT-debian10-i386/cxx14. Errors:
Failing tests: |
|
@Axel-Naumann is everything okay? |
|
Starting build on |
|
Build failed on ROOT-debian10-i386/cxx14. Failing tests: |
|
Should be fine now |
|
@Axel-Naumann @couet everything ok with this? |
tutorials/hist/ReadROOTFile.C
Outdated
|
|
||
| void ReadROOTFile() | ||
| { | ||
| TFile *f = new TFile("demo.root"); |
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.
The macro https://root.cern/doc/master/h1draw_8C.html does something similar to what you are doing. It creates the file hsimple.root if it does not exist, get the histograms in it and draw them.
| #include "TInterpreter.h" | ||
|
|
||
| void h1draw() | ||
| void h1ReadAndDraw() |
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:
% 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' )
| 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', |
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.
have you renamed ./tutorials/pyroot/h1draw.py ? it do not see this file renaming in that PR (I may have missed it)
tutorials/hist/h1ReadAndDraw.C
Outdated
| if (gBenchmark->GetBench("hsimple") < 0) gInterpreter->LoadMacro(dir.Data()); | ||
| TFile *example = (TFile*)gROOT->ProcessLineFast("hsimple(1)"); | ||
| if (!example) return; | ||
| // Generate the ROOT File |
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.
Now the comment should not be "generate the ROOT file" as you assume the file already exists. It is not generated.
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.
@AdvaitDhingra can you change the comment ?
|
Starting build on |
|
Build failed on ROOT-debian10-i386/cxx14. Errors:
|
* Modified h1draw.C tutorial I clarified some things. Modified tutorial Removed my file and modified h1draw.C Minor changes Fixed mistake Simplified * Changed name * Renamed pyroot file * Update h1ReadAndDraw.C
This Pull request:
Changes or fixes:
Adds a tutorial demonstrating how a Histogram can be read from a ROOT File. I also added one that demos how a rootfile with a histogram can be made.
Checklist:
As mentioned in this forum post.