Hello, I’m using root 6.02
I try to write a marco to read root file by this:
Float_t DsvpvDistance[Max_Dsize];
Float_t DsvpvDistance_2D[Max_Dsize];
nt->SetBranchAddress(“DsvpvDistance”,DsvpvDistance);
nt->SetBranchAddress(“DsvpvDistance_2D”,DsvpvDistance);
ie, in the root file , there are two leaves with similar name “DsvpvDistance” and “DsvpvDistance_2D”, one end up with additional “_2D”,
when nt->GetEntry(i), for some root file it works, but for some files the DsvpvDistance[iDsize] will not be able to read and are all 0.
This probelm seems to be solved by adding and changing :
TBranch *b_DsvpvDistance;
nt->SetBranchAddress(“DsvpvDistance”, DsvpvDistance, &b_DsvpvDistance);
but why does it happen?