I know my question came up a few times in the past, but I couldn’t find an example. I want to save stl vectors to a branch of a tree in a c++ program, which uses root-classes. Something like the following:
TFile * file = new TFile (“test.root”, “RECREATE”);
TTree * tree = new TTree(“tree”,"");
for(int i = 0; i < 40; i++) vectortest.push_back(i);
tree->Branch(“vectortest”, “vector”, &vectortest);
The program breaks with a segmentation violation. I’m using Root 4.04/02 and Scientific Linux SL Release 3.0.4.
Could you please help me?