Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-9199

TDF: improper handling of branches with leaflists

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: master, 6.12/04
    • Fix Version/s: 6.12/06, 6.14/00
    • Component/s: Other
    • Labels:
      None
    • Environment:

      any

      Description

      TDataFrame deduces he type of TTree branches at runtime using the following logic:

      • if branch->InheritsFrom(tbranchelRef), then the type of the branch is branch->GetClassName()
      • else we check the last character of branch->GetTitle(), expecting title to be of the form "title/X" where X is a character that designates the branch type
      • else the type could not be deduced

      There are some cases that are not covered by this logic:

      1. if the title of the branch is set explicitly by users via branch->SetTitle(), the last character will not represent the type, or worse it could sometimes correspond to a completely different type, leading to errors
      2. leaflists are not supported by TTreeReaderValue. I am not sure how well we deal with failures to read branches with leaflists (even leaflists of length one, where the variable name is different than the branch name)

      Reproducer:

      #include <ROOT/TDataFrame.hxx>
      #include <TTree.h>
      #include <TFile.h>
       
      int main() {
        // create file
        {
          TFile file("f.root", "RECREATE");
          TTree t("t", "t");
          float f;
          auto b = t.Branch("f", &f);
          b->SetTitle("customtitle");
          t.Branch("dontknow", &f, "ff/F");
       
          t.Fill();
          t.Write();
        }
       
        // read and write file with TDF 
        ROOT::Experimental::TDataFrame d("t", "f.root");
        d.Snapshot("t", "out.root");
        
        return 0;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              eguiraud Enrico Guiraud
              Reporter:
              eguiraud Enrico Guiraud
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Actual Start:
                Actual End: