RDataFrame can't snapshot std::array?

I’ve added the

pidf.Snapshot("TheTree", "testfile.root", {"p"});

line to tutorials/dataframe/df012_DefinesAndFiltersAsStrings.C and

$ root -q df012_DefinesAndFiltersAsStrings.C

Processing df012_DefinesAndFiltersAsStrings.C...
Error in <TBranchElement::InitializeOffsets>: Could not find the real data member '_M_elems[2]' when constructing the branch 'p' [Likely missing ShowMember].

I’ve thought ROOT has built-in support for STL collections.

BTW, I use https://root.cern/download/root_v6.18.00.Linux-ubuntu18-x86_64-gcc7.4.tar.gz

Hi,

I don’t think root treats yet std::arrays as stl containers. They can be used as data members and transparent schema evo is guaranteed wrt fixed size C arrays. on the other hand something is still missing for the usage of such containers as top level branches i believe…

best

Hi berserker,
could you please open a jira ticket with a simple reproducer?

I can’t speak to a timescale, but we definitely want to fix this.

Cheers,
Enrico

hi @eguiraud,

maybe i am naive but one could:

  • for writing: detect the type fed to the branch (with c++ or root typesystem) and if std array, create a plain fixed size array branch
  • for reading: just take the address of the first element of the stl array and read into it as if it were a C array.
    the hairy part could eventually be the treatment of nested arrays maybe…

pnine

https://sft.its.cern.ch/jira/browse/ROOT-10215

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.