-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fixes for TTree with complex friend hierarchies #20222
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5733368
[tree] Forward friend tree update notification to all external friends
vepadulano 78ea7fb
[tree] Consider friendship hierarchies in GetFriendAlias
vepadulano 67e33dc
[tree] Fix integer overflow in TTree::Scan
vepadulano 087f68f
[tree] Fix integer overflow in TTree::Draw
vepadulano 55e27f6
[tree] Allow branch lookup preceded by own TChain name
vepadulano 87b1ed9
[tree] Allow leaf lookup preceded by own TChain name
vepadulano 9966e42
[tree] Add regression test for integer overflow in TTree::Scan
vepadulano 77ecbdc
[tree] Add regression test for integer overflow in TTree::Draw
vepadulano 4d90586
[tree] Test complex friendship hierarchies to the same chain
vepadulano 8a30ac5
[tree] Test same branch name appearing in various friendship levels
vepadulano d2fde12
[tree] Test a more complex TTree::Scan expression
vepadulano b9bd32b
[tree] Add regression test for branch name lookup
vepadulano aacd4c1
[tree] Add regression test for TTree friend branch name lookup
vepadulano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #ifndef CMS_DAS_CLASSES | ||
| #define CMS_DAS_CLASSES | ||
|
|
||
| #include <Rtypes.h> | ||
| #include <vector> | ||
|
|
||
| namespace DAS { | ||
| struct Weight { | ||
| int v{1}; | ||
| int i{0}; | ||
| operator int() const { return v; } | ||
|
|
||
| // https://root.cern/manual/io_custom_classes/#restrictions-on-types-root-io-can-handle | ||
| Weight() = default; | ||
|
|
||
| // For vector initialization in test | ||
| Weight(int a, int b) : v(a), i(b) {} | ||
|
|
||
| // https://root.cern/manual/io_custom_classes/#the-classdef-macro | ||
| // NV avoids marking the methods in I/O as virtual (not needed for this struct) | ||
| ClassDefNV(Weight, 1); | ||
| }; | ||
|
|
||
| // Also this is a new type and it gets stored to disk, needs a dictionary | ||
| using Weights = std::vector<Weight>; | ||
|
|
||
| // Stored, needs a dictionary | ||
| struct AbstractEvent { | ||
| // https://root.cern/manual/io_custom_classes/#restrictions-on-types-root-io-can-handle | ||
| AbstractEvent() = default; | ||
|
|
||
| virtual ~AbstractEvent() = default; | ||
| // Destructor is defined, thus we need to implement rule of five | ||
| // https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c21-if-you-define-or-delete-any-copy-move-or-destructor-function-define-or-delete-them-all | ||
| AbstractEvent(const AbstractEvent &) = default; | ||
| AbstractEvent &operator=(const AbstractEvent &) = default; | ||
| AbstractEvent(AbstractEvent &&) = default; | ||
| AbstractEvent &operator=(AbstractEvent &&) = default; | ||
|
|
||
| Weights weights; | ||
|
|
||
| inline int Weight() const { return weights.front(); } | ||
|
|
||
| // https://root.cern/manual/io_custom_classes/#the-classdef-macro | ||
| ClassDef(AbstractEvent, 1); | ||
| }; | ||
|
|
||
| struct GenEvent : public AbstractEvent { | ||
| // Default constructor for ROOT I/O | ||
| GenEvent() = default; | ||
|
|
||
| // This is a derived class of a pure virtual class, we need to override all virtual functions | ||
| // https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final | ||
| ~GenEvent() override = default; | ||
| // Destructor is defined, thus we need to implement rule of five | ||
| // https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c21-if-you-define-or-delete-any-copy-move-or-destructor-function-define-or-delete-them-all | ||
| GenEvent(const GenEvent &) = default; | ||
| GenEvent &operator=(const GenEvent &) = default; | ||
| GenEvent(GenEvent &&) = default; | ||
| GenEvent &operator=(GenEvent &&) = default; | ||
|
|
||
| // https://root.cern/manual/io_custom_classes/#the-classdef-macro | ||
| // Override because this is a derived class | ||
| ClassDefOverride(GenEvent, 1); | ||
| }; | ||
|
|
||
| } // namespace DAS | ||
|
|
||
| #endif // CMS_DAS_CLASSES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #ifdef __CLING__ | ||
|
|
||
| #pragma link C++ class DAS::Weight+; | ||
| #pragma link C++ class std::vector<DAS::Weight>+; | ||
| #pragma link C++ class DAS::AbstractEvent+; | ||
| #pragma link C++ class DAS::GenEvent+; | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.