ROOT assumes that that memory can be used to read the branch for the events in the tree. If you want to accumulate the content of the branch, you should make a copy.
If I may suggest, you could use for that RDataFrame:
ROOT::RDataFrame rdf("myTree", "myFile.root");
auto b = rdf.Take<std::vector<double>>("a");
Thank you for your reply, this looks good, but I’m using a old version of ROOT on the server (ROOT v6.18), so I need to know how to use a old method to do it…
b.push_back(std::move(*a));
I think you mean this line is not correct and I should not use std::move()?