Dear ROOT experts,
I've been trying to extract a subset of events from a ROOT tree using code
similar to that shown at the end of this message.
It runs OK (after removing the code in the automatically generated
TMBTree destructor - otherwise I get a segmentation violation) BUT when I
then run code over the new TFile, I get this output:
Error in <TBuffer::ReadObject>: object tag too large, I/O buffer corrupted
(...the above line appears 492 times in the real output - there are 374
branches in the tree...)
*** Break *** segmentation violation
Generating stack trace...
0x401d6cbb in TUnixSystem::StackTrace(void) + 0x25b from
/home1/sdean/root305/lib/libCore.so
0x401d5812 in TUnixSystem::DispatchSignals(ESignals) + 0xb2 from
/home1/sdean/root305/lib/libCore.so
0x401d49bb in <unknown> from /home1/sdean/root305/lib/libCore.so
0x401d8585 in <unknown> from /home1/sdean/root305/lib/libCore.so
0x40f32f75 in <unknown> from /lib/i686/libpthread.so.0
0x42029188 in <unknown> from ./runTMBTree
0x4013f447 in TRef::Streamer(TBuffer &) + 0x3f from
/home1/sdean/root305/lib/libCore.so
0x401adbb4 in TStreamerInfo::ReadBufferClones(TBuffer &, TClonesArray *,
int, int, int) + 0x1c9c from /home1/sdean/root305/lib/libCore.so
0x40d32a52 in TBranchElement::ReadLeaves(TBuffer &) + 0x8ca from
/home1/sdean/root305/lib/libTree.so
0x40d2c5dc in TBranch::GetEntry(int, int) + 0x1b4 from
/home1/sdean/root305/lib/libTree.so
0x40d31912 in TBranchElement::GetEntry(int, int) + 0x1da from
/home1/sdean/root305/lib/libTree.so
0x40d318b5 in TBranchElement::GetEntry(int, int) + 0x17d from
/home1/sdean/root305/lib/libTree.so
0x40d4ac90 in TTree::GetEntry(int, int) + 0x98 from
/home1/sdean/root305/lib/libTree.so
0x40d36add in TChain::GetEntry(int, int) + 0x49 from
/home1/sdean/root305/lib/libTree.so
0x08060908 in TMBTree::Emu(int, int) + 0xf20 from ./runTMBTree
0x0806694e in main + 0x1aa from ./runTMBTree
0x42017589 in __libc_start_main + 0x95 from ./runTMBTree
0x0804a6a1 in __register_frame_info + 0x3d from ./runTMBTree
Aborted
Can anyone halp me fix this?
Thanks a lot,
Simon Dean
(compiled code - TMBTree.cpp and TMBTree.hpp were produced by the
MakeClass() function)
=====/ runTMBTree.cpp /====
#include "TMBTree.cpp"
int main(){
TMBTree data(filename);
data.SeparateChannels();
return 0;
}
=====/ TMBTree.cpp /=====
#include "TMBTree.hpp"
void TMBTree::SeparateChannels(){
if (fChain == 0) return;
int nentries = (nevents)?nevents:int(fChain->GetEntries());
TFile *newfile = new TFile("SeparateChannels.root","RECREATE");
TTree *newtree = fChain->CloneTree(0);
for (int jentry=0; jentry<nentries;jentry++) {
int ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
if (....) newtree->Fill()
}
newtree->Write("",TObject::kOverwrite);
newfile->Close();
return;
}
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET