To make tree branch of type vector<deque<float>>

This code doesn’t work.

void test() {
  gInterpreter->GenerateDictionary("vector<deque<float> >","vector");
  TFile* file = new TFile("file", "recreate");
  TTree* tree = new TTree("tree", "tree");
  std::vector< std::deque<float> > vecdeq;
  tree->Branch("branch", &vecdeq);
  vecdeq = {{1, 2, 3, 4}, {5, 6, 7}};
  tree->Fill();
  tree->Write();
  file->Close();
}

The message is: “Error in TTree::Branch: The class requested (vector<deque >) for the branch “branch” is an instance of an stl collection and does not have a compiled CollectionProxy. Please generate the dictionary for this collection (vector<deque >) to avoid to write corrupted data.”
How can I make tree branch of type vector<deque>?

I think @pcanal can most probably help you

1 Like

Can you try with:

gInterpreter->GenerateDictionary("std::vector<std::deque<float> >","vector;deque");
1 Like

Indeed the ‘deque’ header is missing in the original. Also to force the regeneration of the dictionary you may need to do:

rm AutoDict_vector_deque_float___*

Cheers,
Philippe.

1 Like

Thank you very much for your helpful information!

I confirmed that it works. Thank you!

1 Like

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