I can't read a tree with a sub-branch into a cicle

Hi
I have a problem when I try to read a root file with a tree with a sub-branch with the latest version of ROOT (5.32). With version 5.24 all works fine :open_mouth:
This is my simply code :

[code]{
gSystem->Load(“lib_root/libDiamond.so”); //by me

struct Evento {
Int_t Signal, Nelements ;

  Double_t AmpMax1 , AmpMax2 , TimeRise1 , TimeRise2 ;
  Double_t TimeMax1, TimeMax2;
  Double_t Time1_10 , Time2_10 , Time1_90 , Time2_90 ;
  Int_t index[502];
  Double_t time1  ,time2[502],amp1[502] ,amp2[502] ;

};

TFile filein(“fileD.root”);
TTree th = (TTree)filein->Get(“tree”);
Diamond *DI = new Diamond();
TElement *el = new TElement();
TBranch *bh = th->GetBranch(“Diamond”);
bh->SetAddress(&DI);
Int_t indice = 0;
th->GetEvent(0);
Int_t Ntot = th->GetEntries();
struct Evento evt[Ntot];
for (Int_t i=0; i<Ntot; i++){
bh->GetEntry(i);
evt[indice].AmpMax1 = DI->ampMax1;
evt[indice].Nelements = DI->Nelements;
for (Int_t j=0; j<evt[indice].Nelements ; j++){
el=DI->GetElement(j);
evt[indice].time1[j]=el->GetTime1();
}
indice ++;
}
}[/code]
It stops to work at the point for (Int_t j=0; j<evt[indice].Nelements ; j++) … Have you got any idea ??? With the older root version this kind of macro worked fine… thanks

Hi,

Can you try after replacing: bh->SetAddress(&DI);with th->SetBranchAddress("Diamond",&DI);

Cheers,
Philippe.