-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Tutorial] How to create ROOT Dictionary for a custom class is a stand-alone C++ project #13205
[Tutorial] How to create ROOT Dictionary for a custom class is a stand-alone C++ project #13205
Conversation
and how it is used to write and read a TTree
Can one of the admins verify this patch? |
Many thanks, @atolosadelgado! This will be reviewed soon! |
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.
Many thanks for the contribution, @atolosadelgado 🙂!
I have attached some comments though to further improve the code in the PR!
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Co-authored-by: Javier Lopez-Gomez <javier.lopez.gomez@cern.ch>
Hi, I implemented most of the changes, but I would need some indications for the rest:
Thank for your time and effort, |
Hi Javier, thank you for your comments. If I understood properly, the comment by P. Canal about the dot at the end of the branch name means that it is mandatory in this case to avoid degeneracy, and a good practice in general. For that reason the branch names in this tutorial end with a dot. Regarding the README file, I have added your suggestion about the linkdef file. Would you add something else? The files .c and .h now follow the clang-format style. |
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.
See comment. Also, I guess it builds and works out of the box, right? (didn't test it myself)
Regarding the README file, I have added your suggestion about the linkdef file. Would you add something else?
As a first version, I think it's okay as-is, but let's also see what @vepadulano and @pcanal think.
Hi Javier, I have added some comments in the writeTree.cpp about the final dot in the branch name. In addition, I have added 2 sentences to the README. Thank you for your patience. |
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.
I think it's essentially good to go 👍; I stil have to try that it builds and compiles without any issue though!
@vepadulano, @pcanal could you take another look too? If you also think it's ready, we could merge even this week.
@phsft-bot build |
Starting build on |
Build failed on ROOT-ubuntu2204/nortcxxmod. |
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.
Thanks again for this nice work! I think it's a good demonstration of the dictionary capabilities. I left a last minor comment to make a clarification in the doc.
One other suggestion that slipped through my review. 45 commits is probably too much for this PR and they should be squashed into one or a few more. |
Indeed, we could squash on merge into a single commit; what do you think, @atolosadelgado? |
@phsft-bot build |
Starting build on |
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.
Many thanks for the contribution! I tried the tutorial and it works without any issue 👍! The PR will be merged after the CI test results are available.
Build failed on ROOT-ubuntu2204/nortcxxmod. Failing tests: |
Changes were addressed in one of the previous commits. Thanks for the review, Bertrand!
#---Include a CMake module which makes use of the previous variables and loads modules | ||
# with useful macros or functions such as ROOT_GENERATE_DICTIONARY | ||
# For further details: https://root-forum.cern.ch/t/how-to-integrate-root-into-my-project-with-cmake/37175 | ||
include(${ROOT_USE_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.
This way of including ROOT is a bit outdated, see a more modern way here: https://cliutils.gitlab.io/modern-cmake/chapters/packages/ROOT.html
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.
Thank you! I think those tips are worth to be included as part of the official ROOT documentation :)
…d-alone C++ project (root-project#13205) Added tutorial that illustrates how to create a ROOT dictionary for a custom class and how to read/write objects of a user-defined class in `TTree`.
Hi,
This Pull request:
This PR comes from this forum thread. This tutorial is a minimal working example about how to create a ROOT dictionary for a custom class, and its use for writing and reading a TTree.
Further changes may be needed before full integration into ROOT project.
Changes or fixes:
New folder added,
tutorials/tree/dictionary
Checklist: