Skip to content

[treereader] Try harder when looking for a leaf#7889

Merged
eguiraud merged 4 commits intoroot-project:masterfrom
eguiraud:treereader_find_leaf
Apr 17, 2021
Merged

[treereader] Try harder when looking for a leaf#7889
eguiraud merged 4 commits intoroot-project:masterfrom
eguiraud:treereader_find_leaf

Conversation

@eguiraud
Copy link
Copy Markdown
Contributor

Before this patch, given a TTree with a branch with name different
from its leaf, e.g. like this:

*Br    0 :NUD_total_ADC : nud_total_adc/D

TTreeReaderValue failed to retrieve the leaf when the named passed
to the constructor was just "NUD_total_ADC" (while it worked fine
with "NUD_total_ADC.nud_total_adc"). In comparison, in a similar
situation TTree::Draw "tries harder" and it assumes that the
desired leaf is the first sub-leaf of the specified branch.

With this patch, TTreeReaderValue tries FindLeaf after GetLeaf
and as a last resort it picks the branch sub-leaf if it exists and
it is unique.

This fixes #6881.

@eguiraud eguiraud requested review from Axel-Naumann and pcanal April 15, 2021 12:51
@eguiraud eguiraud self-assigned this Apr 15, 2021
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

Before this patch, given a TTree with a branch with name different
from its leaf, e.g. like this:

```
*Br    0 :NUD_total_ADC : nud_total_adc/D
```

TTreeReaderValue failed to retrieve the leaf when the named passed
to the constructor was just "NUD_total_ADC" (while it worked fine
with "NUD_total_ADC.nud_total_adc"). In comparison, in a similar
situation `TTree::Draw` "tries harder" and it assumes that the
desired leaf is the first sub-leaf of the specified branch.

With this patch, TTreeReaderValue tries `FindLeaf` after `GetLeaf`
and as a last resort it picks the branch sub-leaf if it exists and
it is unique.

This fixes root-project#6881.
@eguiraud eguiraud force-pushed the treereader_find_leaf branch from 26b6324 to 45c27e1 Compare April 15, 2021 16:32
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@eguiraud
Copy link
Copy Markdown
Contributor Author

Now with a test 😄

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@eguiraud eguiraud merged commit cf7902d into root-project:master Apr 17, 2021
@eguiraud eguiraud deleted the treereader_find_leaf branch April 17, 2021 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TTreeReader] Partial leaf/branch names not recognized in cases that TTree::Draw supports

3 participants