TTree with vectors

First of all, hello. I am almost new here and besides I have been working around with Root a little bit I have almos never came here.

Today I have a question which I couldn’t find the answer for. It is the first time I am working with TTrees and i would like to create a tree with branches which are vectors or vectors of vectors. What I do is what I saw in an example which I cannot find the link now.

Create the TTree and branch

TTree *t = new TTree(“t”, “Test TTree”);
vector v;
t->Branch(“v”,&v)

Do some code to give value to v and Fill

t->Fill();

I have also crated a TFile. I do t->Write() before ending the program.

When I do this with int, doubles, etc. I have no problem to create a new TTree but when I try to do this with vectors lots of errors came out and some files are auto created with this name

AutoDict_vector_vector_int_allocator_int______cxx_ACLiC_dict.cxx

or something similar. I think it has to be with dictionaries but I don’t know exactly what these dictionaries are and how to work with them. I have been looking around but what I have found seems a little bit harder that what I think is needed in order to solve this problem.

Can someone give me some idea on how to create these branches and finally create the TTree?

Thank you so much!

For “std::vector<std::vector >” see [url]Storing 2D vector [--> vector<vector<...> >] into a TTree
For “std::vector<std::vectorstd::string >” see [url]Problem in getting the vector < vector <string> > branch

Hi Pepe Le Pew!

Thanks so much. I will try that and tell you about it. I cannot work well with dictionaries yet, I am not used to :confused:

Thank you!