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

TTreeReaderArray and variable-sized C-style array don't mix

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.04/02
    • Fix Version/s: 6.10/00
    • Component/s: None
    • Labels:
      None
    • Environment:

      Linux

    • Development:

      Description

      A sketch of my tree looks like this:

        int nTracks;
        float pval[large_number_and_overflow_is_checked];
        ...
        TTree* T = new TTree("t", "data");
        T->Branch("nTracks", &nTracks, "nTracks/I");
        T->Branch("pVal", pval, "pval[nTracks]/F");

      I'm trying to read this as:

       
        TTreeReader reader(t, file);
        TTreeReaderValue<int> nTracks(reader, "nTracks");
        TTreeReaderArray<float> pVal(reader, "pVal");

      I'm getting:

      Error in <GetBranchContentDataType()>: The branch pVal was created using a leaf list and cannot be represented as a C++ type. Please access one of its siblings using a TTreeReaderValueArray:
      Error in <GetBranchContentDataType()>:    pVal.pval
      Error in <CreateContentProxy()>: Cannot determine the type contained in the collection of branch pVal. That's weird - please report!

      Obviously, I had to write a bug report. I'm guessing that the second and third error messages are just error handling gone wrong, and the real issue is the first error. Using TTree::Print and the tree-viewer I can verify that the values are written correctly.

      Now, it shouldn't be too hard to translate a C-Style array into whatever type you want to use for the TTreeReaderArray, so I would consider any inability to do so a serious shortcoming [*], but that's not what the error message is telling me.

      What's really confusing is the last part of the first message, where I'm asked to "access one of its siblings". Is that Japanese-type politeness (i.e. instead of saying "don't do this" it says "please do something entirely unrelated") or is that pointing me to a different way of achieving my ends?

      [*] I'm aware of the perceptive bias that encourages me to assess this shortcoming as serious

        Attachments

          Activity

            People

            Assignee:
            axel Axel Naumann
            Reporter:
            20bb69b559e97a92f35e Tobias Schl├╝ter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: