I always fill trees, but right now I’m doing something that requires me to fill individual branches. I’ve been reading around but couldn’t make use of the answers given. To keep it simple, I have defined:
tree = new TTree(“Tree”,“Tree”);
Then in a loop I have branch=int_number, where int_number are values I’m getting from another branch of an input tree. If I do tree->Fill() there are no problems, but I would need to do something like branch->Fill(), and when I do it like that I get “error: member reference type ‘int’ is not a pointer”. I guess it has to do on how I define my branch and I have tried to do many things about it but couldn’t find a solution yet.
TBranch *b = tree->Branch(...);
Thanks! I was making the mistake of doing TBranch *branch in place of int branch, but both have to be used at the same time and with different names.
I don’t get errors now, but I had to do tree->SetEntries() otherwise tree->GetEntries() returns 0.
Apparently for printing on screen the values I don’t need to put any info regarding b, I just loop on the tree and print branch, is this right? Being the name of the branch (“b”) irrelevant when reading the information? (since I access it with “tree” and “branch” information only).
Apparently for printing on screen the values I don’t need to put any info regarding b,
Likely … I am not quite sure what you mean though (I am a bit confused on what is a variable and what is a branchname in your text).
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.