Hi
>From reading the user's manual I'm unsure how to read a variable array
of doubles from a TTree. E.g.
The TTree has a branch
*............................................................................*
*Br 12 :nGenjet5 : nGenjet5/I *
*Entries : 638 : Total Size= 14992 bytes File Size = 0 *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
and another
*............................................................................*
*Br 21 :Etgenjet5 : Etgenjet5[nGenjet5]/D *
*Entries : 638 : Total Size= 36769 bytes File Size = 0 *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
So in my Root file I do
Int_t i, j, nGenjet5;
TArrayD *Etgenjet5=0;
//[ Set up the TTree from a file here] then
Int_t nevent = (Int_t) T->GetEntries();
T->SetBranchAddress("nGenjet5",&nGenjet5);
T->SetBranchAddress("Etgenjet5",&Etgenjet5);
for (i=0;i<nevent;i++) // Loop over Events
{
T->GetEntry(i);
for (j=0;j<nGenjet5;j++)
printf("j=%d value=%f\n",j,Etgenjet5[j]);
}
This quicjly causes a segfault...
Any ideas would be appreciated :-)
Conrad
--
*-----------------------------------------*
| Conrad Steenberg |
| Caltech, Mail Code 356-48 |
| Pasadena, CA, 91125 |
| e-mail: conrad@hep.caltech.edu |
| Tel: (626) 395-8758 |
*-----------------------------------------*
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:08 MET