Question about adding a vector as a branch into a tree


I tried

std::vector * value = new std::vector(500)

tree-> Branch(“value”,“std::vector”&value);

but it doesn’t put any thing into the tree

So what should I do if I want to add a int vector as a branch? Thanks

I know I could use array, but to make it consistent with my other files, it is better for me to try vector. Thanks


std::vector<int> * value = new std::vector<int>(500) tree-> Branch("value","std::vector<int>",&value);
should work. You still need to put data in your vector (aka value->push_back(someint); ) and fill the tree (tree->Fill():wink:
for each ‘event’.