Home | News | Documentation | Download

Question on vector<vector<int>> using RDataFrame

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

CentOS Linux release 7.9.2009 (Core)q

i am trying to read a root tuple created by someone else. the leaves are mostly vector<vector >.
when i create and rdf and use GetColumnType it returns ROOT::VecOps::RVec<vector>, which
is sensible. i read in another posting one needs to create a ROOT.gInterpreter.Declare in order to
loop over the vector. i am not exactly sure how to do that. my attempt is
int break_vector_vector(const ROOT::RVec<vector>& var1) {
std::cout << var1.size() << std::endl;
for (std::size_t i=0; i<var1.size(); i++) {
for (std::size_t j=0; j<var1[i].size(); j++) {
std::cout << i << " " << j << std::endl;
return 0;

an unrelated question is the cout’s done seem to execute within the gInterpreter in rdataframe python.
is there a trick to using this? thanks in advance. …kj

Hi @kjohns; I am sure @eguiraud can help you with this.


Hi @kjohns,
you are using Python, not C++, correct?

What does not work exactly? The function definition seems ok at first glance. Can you post a self-contained snippet that shows the problem (with full error message)?


8 posts were split to a new topic: Snapshot of RVec<RVec> produces broken ROOT file

Move the conversation with @clementhelsens to another topic. @kjohns let us know if you are still having issues.