RDataFrame Snapshot with RVec<vector< type >> branches

I’ve made an RDataframe on TTrees across 1k files within Python so I can define new columns and files. The difficult part is after some Defines / Filters I want to Snapshot the results into a small file so I don’t have to re-filter across my Gbs of data every time.

However, a snapshot fails with:

The class requested (ROOT::VecOps::RVec<vector<double> >) for the branch "pixel_reset" is an instance of an stl collection and does not have a compiled CollectionProxy. Please generate the dictionary for this collection (ROOT::VecOps::RVec<vector<double> >) to avoid to write corrupted data.
_Please read [tips for efficient and successful posting](https://root-forum.cern.ch/t/tips-for-efficient-and-successful-posting/28292) and [posting code](https://root-forum.cern.ch/t/posting-code-read-this-first/28293)_

I have tried the following to no avail:
building a G__dictionary against my linkdef:

#include <ROOT/RVec.hxx>
#include <vector>
#ifdef __ROOTCLING__
#pragma link C++ class vector<vector <float> >+;
#pragma link C++ class vector<vector <double> >+;
#pragma link C++ class RVec<vector <double> >+;
// no linking difference from
// #pragma link C++ class ROOT::VecOps::RVec<vector <double> >+;

and loading with

ROOT.gSystem.Load("libmyDict.so") // with pcm file in directory too

also using:

ROOT.gInterpreter.GenerateDictionary("ROOT::VecOps::RVec<vector<double>>", "vector")

Fails with the same error.

Creating an object of the specified type fails.

Given any tree with branch of type:


as shown with:


…How do I get this rdf to snapshot with these branches??

Reproduce by PyROOT:

import ROOT
rdf = ROOT.RDrameFrame("myStupidTree", "myPoorlyconstructedFile.root")
rdf.Snapshot("whatever", "slightlyLessWorse.root")

ROOT Version: ROOT Version: 6.27/01
Platform: ubuntu1~20.04.1
Compiler: c++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

Which command line did you try?


rootcling -f /var/tmp/dict.cxx ROOT/RVec.hxx /var/tmp/vlinkdef.h 

it works for me.

For GenerateDIctionary you will need to also pass the RVec header file:

ROOT.gInterpreter.GenerateDictionary("ROOT::VecOps::RVec<vector<double>>", "vector;ROOT/RVec.hxx")
1 Like

The GenerateDictionary method works by adding ;ROOT/RVec.hxx

I’m still not able to get the linkdef to load it correctly, though.

I’ve tried:

rootcling -f /var/tmp/dict.cxx ROOT/RVec.hxx LinkDef.h // run from my LinkDef dir

I don’t have a vlinkdef.h file at /var/tmp

Before I was trying:

rootcling -v4 -f mydict.cxx -rmf libmydict.rootmap -rml libmydict.so LinkDef.h

I get the same error as before with both methods.

I am able to get CMake to generate the correct dictionary only if I include a cxx file where I make a global object of RVec<vector< double>> type, and also add a shared library from only that file.

For me, this leads to a compilation error when compiling mydict.cxx:

rootcling -v4 -f mydict.cxx -rmf libmydict.rootmap -rml libmydict.so ROOT/RVec.hxx LinkDef.h

should work.

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