Hi all,
I am trying to reading a large file of events(>4 G bytes) into a TTree and then run BuildIndex on that TTree.
I’m using root 5.08.00
The input file consists of about 61,000,000 events. I create the TTree with:
KSRootPeData* pfRootPe = new KSRootPeData();
TFile* pfTempTreeFile = (TFile*) new TFile("SortTempTreeFile.root",
"RECREATE","Temoprary Sort ROOT file");
pfTempTreeFile->cd();
TTree* pfPeTree=new TTree("PeTree","Pe Tree");
pfPeTree->Branch("Pe","KSRootPeData",&pfRootPe,1000,0);
Where KSRootPeData consists of 11 int and double variables for a total length of 68 bytes.
In a while loop I read events from the input file and Fill the TTree:
while(1)
{
pfRootPe->CopyInPe(pfBinaryPe);
//Test for Eof , is so break else Fill TTree
.
.
pfPeTree->Fill();
}
After reading in and filling about ~27,700,000 events I get:
Fill: Switching to new file: SortTempTreeFile_1.root
When the events have all been loaded (into 2 files? I’m assuming root knows what its doing here…) I call BuildIndex on the TTree:
int fNumIndexes=pfPeTree->BuildIndex(nxStr,nyStr);
This aborts (in gdb) with:
Program received signal SIGABRT, Aborted.
[Switching to Thread 16384 (LWP 16227)]
0x41565741 in kill () from /lib/libc.so.6
(gdb) where
#0 0x41565741 in kill () from /lib/libc.so.6
#1 0x414f3771 in pthread_kill () from /lib/libpthread.so.0
#2 0x414f3a7b in raise () from /lib/libpthread.so.0
#3 0x415654d4 in raise () from /lib/libc.so.6
#4 0x41566a08 in abort () from /lib/libc.so.6
#5 0x400bcf57 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.5
#6 0x400bcf94 in std::terminate () from /usr/lib/libstdc++.so.5
#7 0x400bd106 in __cxa_throw () from /usr/lib/libstdc++.so.5
#8 0x400bd35f in operator new () from /usr/lib/libstdc++.so.5
#9 0x400bd42f in operator new[] () from /usr/lib/libstdc++.so.5
#10 0x426acc4a in TTreeIndex::TTreeIndex ()
from /home/sembrosk/local/src/root/lib/libTreePlayer.so
#11 0x426ae468 in TTreePlayer::BuildIndex ()
from /home/sembrosk/local/src/root/lib/libTreePlayer.so
#12 0x41104b54 in TTree::BuildIndex ()
from /home/sembrosk/local/src/root/lib/libTree.so
#13 0x08052b66 in main (argc=2, argv=0xbfffe65c) at src/ksPeSort.cpp:222
During the BuildIndex the memory usage slowly climbs and reaches ~32% by the time the seg fault occurs.
Can anyone tell me how I should be doing this? This code works fine for files <27,700,000 (before root decides to make the second file).
Thanks,
Glenn