Hi there,
We have a ROOT TTree with branches that are vector<vector<Struct>> and we would like to use RDataFrames to analyze them.
I have attached a minimum example in SimpleNtuple.C that uses a two-field struct defined in SimpleInfo.hh. The macro creates a tree with branches of various dimensions:
- a single SimpleInfo object.
- a vector of SimpleInfo objects
- a vector of vector of ints
- a vector of vector of SimpleInfo objects
and I run into problems when I try to display contents from the last of these.
I can print the branch itself:
+-----+----------------------------------------+
| Row | vector_vector_obj |
+-----+----------------------------------------+
| 0 | { @0xa9931f0, @0xa9931f8, @0xa993200 } |
| | { @0xc5ec7a0, @0xc5ec7a8, @0xc5ec7b0 } |
+-----+----------------------------------------+
but when I try to e.g. look at the first vector, I run into issues.
I’ve tried:
- subscripting:
df.Display({"vector_vector_obj[0]"});
, - asking for an exact field: :
df.Display({"vector_vector_obj[0].pdg"});
, and - creating a new column:
auto df2 = df.Define("vector_vector_obj_0", getElement, {"vector_vector_obj"})
and then try to display the new column withdf2.Display({"vector_vector_obj_0.pdg"});
- getElement is defined as:
ROOT::VecOps::RVec<SimpleInfo> getElement(const std::vector<std::vector<SimpleInfo>>& in) {
return in[0];
}
All of these give some variation of the following error:
terminate called after throwing an instance of 'std::runtime_error'
what(): Column "vector_vector_obj[0]" is not in a dataset and is not a custom column been defined.
Any help would be much appreciated!
Thanks,
Andy
SimpleInfo.hh (111 Bytes)
SimpleNtuple.C (3.3 KB)
Please read tips for efficient and successful posting and posting code
Please fill also the fields below. Note that root -b -q
will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug
from the ROOT prompt to pre-populate a topic.
ROOT Version: 6.32.06 and 6.30.04
Platform: linuxx8664gcc
Compiler: g++ (Spack GCC) 13.3.0