I’m hoping to get the system ugpraded to CentOS 7 soon so I can switch to ROOT 6; this is version 5.34 and none of the precompiled binaries work on CentOS 6 and the C compiler is too old to deal with ROOT 6 as far as I can tell. So I’m stuck with the old way of reading trees.
So, using the old way of setting branch status and address, I am attempting to read data from a tree into a series of arrays but for some reason, GetEntry() is failing to fill the arrays. Because the arrays aren’t filled I can’t work further with this data at the moment.
Here is my script:
TFile *f = TFile::Open("/data/macros/treesort/test.root",“UPDATE”);
Int_t A[256] = {-1};
Int_t C[256] = {-1};
Int_t pixel[256] = {-1};
teb->SetBranchStatus("*", 0);
teb->SetBranchStatus(“pwall.raw.hit.pixel”, 1);
teb->SetBranchStatus(“pwall.raw.hit.A”, 1);
teb->SetBranchStatus(“pwall.raw.hit.C”, 1);
teb->SetBranchAddress(“pwall.raw.hit.pixel”, &pixel);
teb->SetBranchAddress(“pwall.raw.hit.A”, &A);
teb->SetBranchAddress(“pwall.raw.hit.C”, &C);
Long64_t entries = teb->GetEntries();
cout << entries << " entries." << endl;
for (Long64_t i=0; i<entries; i++) {
teb->GetEntry(i);
teb->Show(i);
for (int ii=0; ii<5; ii++) {
cout << "ii: " << ii << " pixel: " << setw(3) << pixel[ii]
<< " A: " << setw(4) << A[ii]
<< " C: " << setw(4) << C[ii]
<< " E: " << i << endl;
}
}
And I get output like this, showing that GetEntry() hasn’t filled the arrays properly but that the data is present.
======> EVENT:149
pwall.raw = (phosWallRaw*)0x20ed010
pwall.raw.hit = (vector*)0x20ed040
pwall.raw.hit.pixel = 236, 244
pwall.raw.hit.A = 93, 181
pwall.raw.hit.C = 289, 448
ii: 0 pixel: -1 A: -1 C: -1 E: 149
ii: 1 pixel: 0 A: 0 C: 0 E: 149
ii: 2 pixel: 0 A: 0 C: 0 E: 149
ii: 3 pixel: 0 A: 0 C: 0 E: 149
ii: 4 pixel: 0 A: 0 C: 0 E: 149
I’m missing something here, but I’m not sure what.