Likely Simple problem with reading TBranch that holds array

Hi everyone I’ve followed the basic example in the user’s guide.
I can get plain simple variables like “floats” to fill correctly and read them back from the tree but I can’t get my arrays to do so.

Relevant sections of the program that fills the tree:

eventTree = new TTree(“eventTree”,“a simplistic event tree”);
eventTree->Branch(“icPlate1E”,&icPlate1E,“icPlate1E/F”); // this branch reads back
eventTree->Branch(“gE”,gE,“gE[30]/F”); // this branch doesn’t read back

Relevant section of the program that reads the tree:

TFile *f = new TFile(“raw15929.root”); // This file has the tree in it
f->ReadAll();
TTree t1 = (TTree)f->Get(“eventTree”);
Float_t x;
Float_t g[30];
t1->SetBranchAddress(“icPlate1E”,&x); // this branch reads back fine
t1->SetBranchAddress(“gE”,g); // this branch doesn’t

As I go through my selector which builds the tree I occasionally, very rarely, get:
Error in : Failed filling branch:eventTree.gE, nbytes=-1

I get the following error message when I try to read the tree:
Error in : unknown branch -> gE

I’ve tried fiddling with having no & and then putting one in to no effect.
Any help much appreciated! Thanks in advance!

Strange :slight_smile:
Could you please provide an example reproduce these errors.

Cheers,
Philippe.

I’de love to provide you with something executable that produces the errors but it’s a large and complicated code that accesses large and complicated files. :frowning:
I’m basically re-working something someone else put together to suit the needs of my experiment.
If the error isn’t something obvious then I won’t bother investigating it, I’ll just make 30 float variables for the array. Looks dumb when coded but it will work.
Thanks anyways!

Chris