I realize that there have already been similar questions, but I cannot figure this out for sometime now.
I have the following snippet of code:
TFile *f = new TFile(“f.root”, “recreate”);
TTree *t = new TTree(“t”, “t”);
vector *v = 0;
t->Branch(“vec”, &v); // tried t->Branch(“vec”, “std::vector”, &v); as well
This code works when interpreted with CINT just fine, it works when I rewrite it in python just fine.
But when I try to compile it against ROOT with my Makefile it doesn’t work(Compiles, but doesn’t execute successfully). The error I get is:
Error in TTree::Branch: The class requested (vector) for the branch “vec” refer to an STL coll. and do not have a CompiledProxy. Please generate the dictionary for this class.
Now, I also have trouble with reading vector. Consider the following snippet of code:
TFile *f = new TFile …
TTree *t = (TTree)f->Get()…
// t->SetMakeClass(1); works!!!
vector *v = 0;
This doesn’t wokr either when I try to run compiled code against ROOT both 5.32(34) It gives me the same error as above. but it successfully runs through the interpreter and python(in python way)
But if I uncomment the line t->SetMakeClass(1) it will work.
Now, I believe that this class should already have a dictionary, since I can use with CINT.
Here you explain how to generate a dictionary: root.cern.ch/drupal/content/how- … dictionary
I tried smth like that, it tells me that it exists, so I don’t understand why I get this error when I run the code.
I tried it for both ROOT 5.32 and ROOT 5.34. Changing float to double works just fine.
I undestand that I can simply use double, but I would like to understand the error if possible!!!