I’m trying to initialize a vector and assign it to a TTree branch that is a vector. So the TTree “treename” has a branch called “jetTruthLabel”. This branch contains vector. I want to be able to access that vector and use it but I can only get the branch, not the vector itself.
Hi. Maybe I can help you. If I understood your question, you have in jetTruthyLabel a vector of something for each event in the tree.I think you could try a for loop and GetEntry.
After
“TBranch* br…”
Try
vector<_something_> *vec = new vector<_something_>;
br_ntruth->SetAddress(&vec);
for(int ev=0;ev<tree->GetEntries();ev++){
vec->clear();
tree->GetEntry(ev);........}
This way you will put in vec the vector you have in your branch (and you can read all branches for an event ev with GetBranch and SetAddress).