Dear Root Authors,
I am trying to read data from a TTree containing a branch filled with vector<map<string, double>>
. Here’s a stripped down version of the code I’m using to do it:
void Minimal_Example(std::string infilename){
gInterpreter->GenerateDictionary("vector<map<string,double> >", "vector");
gSystem->Load("AutoDict_vector_map_string_double____cxx.so");
// Get trees from file
TFile *fin = new TFile(infilename.c_str(),"open");
TTree *tpart = (TTree*)fin->Get("eventweight/ByParticleValidTree_211");
std::vector<std::map<std::string, double>> *UniverseVals=nullptr;
tpart->SetBranchAddress("UniverseVals", &UniverseVals);
tpart->GetEntry(0);
}
Which results in the error:
Error in <TTree::SetBranchAddress>: The class requested (vector<map<string,double> >) for the branch "UniverseVals" is an instance of an stl collection and does not have a compiled CollectionProxy. Please generate the dictionary for this collection (vector<map<string,double> >) to avoid to write corrupted data.
Searching the forum, the solution is supposed to be to generate a dictionary but I’m already doing that in my macro so I’m not sure what else to try here.
Thanks in advance.
Here is the file containing the trees:
trees.root (110.1 KB)
ROOT Version: 6.18/04
Platform: Ubuntu 18.04.5
Compiler: GCC 7.5.0