Problem in getting the vector < vector <string> > branch

Dear Rooters,

I am trying to make a branch in a tree with vector<vectorstd::sting >.
I have a similar code working for vector<vector > and vector<vector >.
I just added a line to create the dictionary for this.

#pragma link C++ class std::vector<std::vector >+;
#pragma link C++ class std::vector<std::vectorstd::string >+;
#pragma link C++ class std::vector<std::vector >+;
#pragma link C++ class std::vector<std::vector >+;
#pragma extra_include “std::vector”;

It compiles fine but when I try to run the code but it tells me the pointer to the “branch_name” is not known by root. This happens when I am trying to filling the branch itself.
I also tried to generate the dictionary using
gInterpreter->GenerateDictionary(“vector<vectorstd::string >”,“string;vector”);

I still see the problem. This problem did not come when I filled the vector of vector of floats/ints. And there,
I generated dictionary using MAKECINT while compiling like I pasted above. And when I had to read the info after filling the branches, I created one using gInterpreter. Here, situation seems to be different. Could someone please help me about what I should do?

Thanks & Regards


Try using the spelling:vector<vector<string> >


Hi Philippe,
It shows the same problem.
I also tried doing it with TString but it shows same problem.

Thanks & Regards

Try: root [0] .x trial.cxx and/or: root [0] .x trial.cxx++ and/or: `root-config --cxx --cflags` -O2 -W -Wall -o trial trial.cxx `root-config --glibs` ./trial and then: root [0] TFile f("trial.root", "READ"); root [1] tree->Print();
See also: [url]Storing 2D vector [--> vector<vector<...> >] into a TTree

P.S. If the above compilation command does not work for you, try: g++ `root-config --cflags` -O2 -W -Wall -o trial trial.cxx `root-config --glibs` ./trial
trial.cxx (4.79 KB)

1 Like

Hi Pepe,
Thanks for the instructions. Though my problem is that I am using all of this
in CMS devoted software.

I think I did what is being done here in the code I am trying to run. But anyway
now am suggested not to use nested vectors
from the experts within the
collaboration. So changing the code anyway.
Many thanks for the attention.

Thanks & Regards