Reading a subbranch


I need to access to a subbranch of a TTree, but unfortunatly I can’t figure out how to do this.

I have tried many things, by using SetBranchStatus, SetBranchAddress, GetBranch, FindBranch and SetAddress, but I must not have find the right order… They all crash with a segmentation violation because the program doesn’t find the subbranch. However, it exists, as showing by the result of GetListOfBranches :

[code]root [3] tree->GetListOfBranches()->Print()
*Br 310 :misc : QRTmicro/i:micro/i:macro/i:helicity/S:gms_mask/S: *

  •     | evt_type/S                                                       *

*Entries : 691849 : Total Size= 12496704 bytes File Size = 5527311 *
*Baskets : 390 : Basket Size= 32000 bytes Compression= 2.26 *

I also tried the Tree4r.C code given here (first reply), but I’m not able to use it correctly :

root [10] bpx->SetAddress(px); Error: illegal pointer to class object bpx 0x0 121 (tmpfile):1: *** Interpreter error recovered ***

All suggestions are welcome…


In the same branch you cannot mix data types of different length (ex ints and shorts). Make one branch for each type.


Gulp… I am not the person who wrote the program which created the rootfile… Do you mean there is no way to read this subbranch ? :confused: I have yet no problem to use it in a TreeViewer…

It might work with the TreeViewer because the leaf addresses are correctly set. Anyhow, regenerate your Tree and read carefully teh documentation.