Skip to content

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

@eguiraud

Description

@eguiraud
  • Checked for duplicates

Describe the bug

First reported here.
For this TTree (the file is linked from the forum post):

root [12] DmpMCEvtNtup->Print("NUD_total_ADC*")
******************************************************************************
*Tree    :DmpMCEvtNtup: DAMPE MC Event nTuple Tree                             *
*Entries :    30000 : Total =        42024515 bytes  File  Size =    5331016 *
*        :          : Tree compression factor =   7.90                       *
******************************************************************************
*Br    0 :NUD_total_ADC : nud_total_adc/D                                    *
*Entries :    30000 : Total  Size=     241261 bytes  File Size  =       7509 *
*Baskets :        8 : Basket Size=      32000 bytes  Compression=  32.06     *
*............................................................................*
DmpMCEvtNtup->Draw("NUD_total_ADC")

works, while

root [13] TTreeReader r(DmpMCEvtNtup);
root [14] TTreeReaderValue<double> rv(r, "NUD_total_ADC");
root [15] r.Next()
Error in <TTreeReaderValueBase::GetBranchDataType()>: The branch NUD_total_ADC was created using a leaf list and cannot be represented as a C++ type. Please access one of its siblings using a TTreeReaderArray:
Error in <TTreeReaderValueBase::GetBranchDataType()>:    NUD_total_ADC.nud_total_adc
Error in <TTreeReaderValueBase::CreateProxy()>: The branch NUD_total_ADC contains data of type {UNDETERMINED TYPE}, which does not have a dictionary.
(bool) false

does not. TTreeReader instead requires the full leaf name:

root [1] TTreeReader r(DmpMCEvtNtup);
root [2] TTreeReaderValue<double> rv(r, "NUD_total_ADC.nud_total_adc");
root [3] r.Next()
(bool) true
root [4] *rv
(double) -999.00000

Expected behavior

TTreeReader should support the same set of "valid branch names" that TTree::Draw supports.

Setup

Reproduced with 6.22/02 and master@4ea4d8943 .

Additional context

This looks similar to https://sft.its.cern.ch/jira/browse/ROOT-7984 and it is (at least part of) the cause of https://sft.its.cern.ch/jira/browse/ROOT-9558 .

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions