I’m having problems accessing the variables for a given tree. Usually it worked for me like in the code example, but now it just says “unknown branch”:
TFile *f = new TFile("selected.root");
TTree *mytree=(TTree*)f->Get("recData");
Float_t fEnergy;
mytree->SetBranchAddress("fEnergy",&fEnergy);
for(Int_t i = 0; i <mytree->GetEntries(); i++){
mytree->GetEntry(i);
cout << fEnergy<< endl;
}
I think that I set the address incorrectly, although I tried variations like the full pathname (event.fFDEvents.fFdRecShower.fEnergy). Please see the attached screenshot of the tree-structure.
Thanks!
In general, one would need your root file in order to try it, but as a first step you could try to use the “full name” of the branch which is something like “event.fFDEvents.fFdRecShower.fEnergy” (if it doesn’t work, either attach your root file here or put it somewhere in a “public area”, e.g. “afs”).